Concurrent Go by node
A worker pool quietly grows for a fortnight, until one quiet Sunday afternoon the service runs out of file descriptors and the on-call engineer learns the difference between a goroutine that returns and a goroutine that leaks. The bug is one missing ctx.Done() check in a loop nobody had reason to suspect. This book is for the Go developer who has shipped sequential code, written a few go f() statements that mostly worked, and now needs to understand the parts that occasionally do not. Seven chapters: the scheduler and the leak shape, channels and close semantics, select and the for-select loop, sync primitives and atomics, context, the four idiomatic patterns (worker pool, fan-out, pipeline, errgroup), and the race detector. Every runnable listing executes in the CivNode browser sandbox; the race-detector chapter is captured output, framed plainly, because -race is a build flag the sandbox cannot express. When a mutex beats a channel, when a channel beats a mutex, and how to ship concurrent code that survives production traffic.