Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Channels are blocking

package main

import "fmt"

func main() {
	ch := make(chan string)
	ch <- "Hello"

	text := <-ch
	fmt.Println(text)
}
fatal error: all goroutines are asleep - deadlock!

goroutine 1 [chan send]:
main.main()
	/home/gabor/work/slides/golang/examples/blocking-channels/blocking_channels.go:7 +0x59
exit status 2