Go Concurrency Patterns
A focused deep dive into Go concurrency: goroutines, channels, select, sync primitives, context cancellation, pipelines, worker pools, errgroup, graceful shutdown and race-free, leak-free production code.
What you'll learn
- Explain goroutines, the Go scheduler and the difference between concurrency and parallelism.
- Use buffered, unbuffered, directional and nil channels with select, timers and tickers correctly.
- Choose between channels, sync.WaitGroup, Mutex, Once, atomics and sync.Map for shared state.
- Propagate cancellation and deadlines with context.Context through call chains and goroutines.
- Build pipelines, fan-out/fan-in, worker pools, errgroup tasks, rate limiters and graceful shutdown.
- Find and prevent data races, goroutine leaks and deadlocks, and test concurrent code deterministically.
Syllabus
Concurrency Foundations in Go
- Concurrency, Parallelism and the Go Scheduler
- Goroutines and Their Lifecycle
- Share Memory by Communicating
Channels in Depth
- Unbuffered vs Buffered Channels
- Closing Channels, Ranging and nil Channels
- Directional Channel Types in APIs