4 ms·
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, a
by harikb 7y ago
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()
- deleted 7y ago[deleted]