Concurrency
Concurrency
Handle parallelism safely and avoid race conditions
Enforceable guidelines from our catalog
Zero-value Mutexes are Valid
The zero-value of sync.Mutex and sync.RWMutex is valid, so you almost never need a pointer to a mutex.
Channel Size is One or None
Channels should usually have a size of zero or one. By default, channels are unbuffered and have a size of zero. Any other size should be subject to a high level of scrutiny.
Do Not Leak Goroutines
Goroutines are not automatically cleaned up by the garbage collector; they must be explicitly terminated. Any goroutine created in production code must have a way to be stopped and waited for
Sign up for free
and get unlimited access to our guidelines catalog
and get unlimited access to our guidelines catalog