2 ms·
Advanced Concurrency Patterns in Go
- gfs 7y agoI know the author points out that the errgroup example usage is safe because each goroutine writes to their own index but I think in general you should always guard data structures that aren't thread safe. Relying on the layout of a slice could lead to a data race in the future.
- eandre 7y agoThat's a reasonable point. Maybe I should update the post to guard it with a mutex to discourage newcomers from doing something subtle. Thanks for the feedback!