Why a Closed Go Channel Is Still Ready to Receive

Imagine a collector listening to two channel inputs. One producer finishes, closes its channel, and never sends again. You expect the collector to ignore that input from now on. Instead, its select keeps entering the closed channel’s receive case. Why would an input with no remaining values still be ready? The distinction depends on whether the channel is open and empty, closed, or referenced through nil. A closed channel can still complete a receive Closing a channel does not discard values already in its buffer. After those values have been received, future receives complete immediately with the element type’s zero value and ok == false. ...

October 17, 2026 · 4 min · 759 words · Jack Li

Go select Is a One-Shot Choice, Not a Continuous Listener

It is easy to look at a Go select and imagine a small event loop that keeps watching every channel forever. That mental model is close enough for simple code. It becomes misleading when a case body changes channel state or another goroutine becomes runnable. The smaller model is more useful: one select execution → choose one communication that can proceed → perform that communication → run that case body → this select execution is finished If the program should keep watching channels, something outside that select must enter it again. Most often, that is a for loop. ...

September 22, 2026 · 6 min · 1207 words · Jack Li