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. ...