go-proverbs / go-proverbs.github.io

Inspired by @rob_pike talk at Gopherfest SV 2015
MIT License
334 stars 21 forks source link

Concurrency proverb #20

Open KernelDeimos opened 7 years ago

KernelDeimos commented 7 years ago

I suggest adding the following:

Always sync.WaitGroup if every goroutine must finish

I got a very confusing race condition changing an unbuffered channel to a buffered channel, as I was waiting for one goroutine to finish but ignoring the other.

KernelDeimos commented 7 years ago

I have an addition:

Loop variables used in anonymous goroutines by lexical scoping will not be what you expect