In the example below I am sending "ping"s to 'mq' string channel in anonymous go routine and try to receive these strings in four dequeue() goroutines , not sure why it doesn't print anything
$ cat channels2.go
...
var mq chan string
func main() {
mq = make(chan string)
for i := 0; i < 4; i++ {
go dequeue()
}
go func() {
for i := 0; ; i++ {
mq <- "ping"
}
}()
}
func dequeue() {
for m := range mq {
fmt.Println(m)
}
}
$ go run channels2.go
$