Concurrency
How Go Channels Work: The Behavior Matrix
A practical guide to Go channels — receive, send, and close behavior across nil, unbuffered, buffered, and closed states
Channels are Go’s primary tool for coordinating goroutines, but their behavior changes drastically depending on their state. A channel can be nil, unbuffered, buffered, or closed — and the same operation (send, receive, close) does something different in each case. Getting this matrix wrong is how deadlocks and panics happen.