Go Concurrency Distilled: A Quick Refresher with Interactive Examples

This mini-book offers a concise overview of Go concurrency, covering goroutines, channels, select, pipelines, and more. Each topic includes interactive examples that readers can modify and run directly in the browser. A PDF version with static examples is also available. The book is positioned as a quick refresher, not a beginner's guide, and is AI-free.
This is a quick refresher on Go concurrency, not a beginner's guide.
- SamInTheShell
The concurrency and threading in Go just feels like magic compared to every other language. I'm a goroutine addict and I refuse to be rehabilitated.
Just from observations over the years, I don't think there's any other language quite like this, in terms of how things can end up happening in any thread.
- voidfunc
Ive been writing Go for over a decade and I still feel like I never quite "got" channels. Every time I use them I need to go consult the manual, and none of the patterns feel obvious which is weird considering the rest of the language feels very obvious.
Too many years of Java and managing Threads and Runnables probably rotted my brain.
- fizlebit
One thing I always found more work than I would expect is when you have a graph of operations, think a Makefile, but a bit dynamic. For this model completable futures and executors seem to work well (provided the graphs is smallish), but golang is (or perhaps before generics) just was difficult.
- kccqzy
For many people, besides learning what you should do, it is more helpful to read anti-patterns and things you should not do in Go, and none is better than this article about data race patterns in Go: https://www.uber.com/us/en/blog/data-race-patterns-in-go/
- Jeeetendra
honestly the hard part of go concurrency was never starting goroutines, it's making cancellation and shutdown behave. nice to see context, races and diagnostics in one runnable place.
- rienbdj
Is a Go channel equivalent to a Haskell tvar ?
- phplovesong
Go has a really good concurrency story. Its one of the best ones out there. Some langs have async/await (usually sucks) and some nothing att all (like php)
- Segv77
Go concurrency seems simple on the surface, but mastering select and proper error handling takes practice. Good to see this topic distilled.