Concurrency - Golang - Complete Documentation by ntxm.org

Goroutines in Go

Start concurrent work with the go keyword and wait for it to finish with sync.WaitGroup.

Channels in Go

Send values between goroutines with channels, close and range over them, and wait on several at once with select.

Shared State in Go Concurrency

Protect shared data with sync.Mutex and sync.RWMutex, run setup once with sync.Once, choose between channels and mutexes, and find races with -race.

Concurrency Patterns and Problems in Go

Fix all goroutines are asleep deadlocks, build worker pools, and run failing tasks concurrently with errgroup.