goroutines

Understanding golang channel range... again

In a previous article, I tried to explain my understanding of go channels interaction with ranges. Turns out my explanation was probably not clear enough because here I am, nearly a year after, struggling to achieve pretty much the same exercise. So here we go again, on a good old trial and error fashion progress. The goal here is to retrieve channel messages that are pushed from go routines created in a for loop.

Understanding golang channel range

Here we go again with my golang self teaching, today with a topic I had hard time understanding correctly (and hope I actually did): range over channels along with goroutines. First of all, let’s have a little reminder. We all know a goroutine live its own life and must be waited for at the main level, i.e. in this example: package main import "fmt" func main() { go func() { fmt.