News for hackers. Stuff that matters.
Re:Go Things I Love: Channels and Goroutines by leCapitalist on Tuesday January 07, 2020 @01:31AM (#21977513)
Edit: removed (can’t seem to delete?)
Re:Go Things I Love: Channels and Goroutines by harikb on Tuesday January 07, 2020 @01:37AM (#21977548)
No, GP was taking about a clear race condition on growing the slice in the first example. It is not just a case of "idiomatic go" vs "idiomatic" or something, as the author suggested, a problem only when the code grows. It is a critical bug in the first example.

Edit: add what one gets when run with `go run -race`

> WARNING: DATA RACE > Read at 0x00c0000a6000 by goroutine 8: > runtime.growslice()