4 ms·
I believe the guidance addresses this. > Programs that modify data being simultaneously accessed by multiple goroutines must serialize such access. > To seria
by ferdowsi 5y ago
I believe the guidance addresses this.
> Programs that modify data being simultaneously accessed by multiple goroutines must serialize such access.
> To serialize access, protect the data with channel operations or other synchronization primitives such as those in the sync and sync/atomic packages.
Go gives us `sync.WaitGroup` and `errgroup.Group` as abstractions to manage concurrent operations. I always end up guiding developers towards using these unless they absolutely can't (like responding to OS signals requires interacting with channels).
- pkaye 5y agoFor OS signals now they added NotifyContext() which uses context instead of channels.