kkdai / blog

This is blog comment repo for https://www.evanlin.com/
0 stars 0 forks source link

til-buffered-channel/ #24

Closed kkdai closed 3 years ago

kkdai commented 3 years ago

[Golang] Golang buffered/unbuffer channel and pipeline

http://www.evanlin.com/til-buffered-channel/

kkdai commented 3 years ago

comment written by Square_sun, created at 15 Jul 18 06:06 UTC,

最後的那一段code,wg.Done()不是應該放在for n := range in外面嗎@.@??

kkdai commented 3 years ago

comment written by Matt Ho, created at 20 Jul 18 03:33 UTC,

應該是筆誤, 另外 WaitGroup doc 的 example 也建議 wg.Done() 放 defer, 怕那個 for 爆炸沒跑到 done: https://golang.org/pkg/sync...

kkdai commented 3 years ago

comment written by Evan Lin, created at 21 Jul 18 07:28 UTC,

感謝兩位提醒...的確是筆誤... 已經修改好了