Thank you for putting Go by Example online. It has helped me a lot on my journey to learn Golang.
The 3rd paragraph on Range Over Channels states
If we didn’t close it we’d block on a 3rd receive in the loop.
But if we take close(queue) out of the example, an error is created on the 3rd iteration. Here is the result:
close(queue)
one two fatal error: all goroutines are asleep - deadlock! goroutine 1 [chan receive]: main.main() /tmp/sandbox354051104/main.go:22 +0x120
Thank you for putting Go by Example online. It has helped me a lot on my journey to learn Golang.
The 3rd paragraph on Range Over Channels states
But if we take
close(queue)out of the example, an error is created on the 3rd iteration.Here is the result: