Operation rules

OperationnilClosed channelOpen buffered channelOpen unbuffered channel
ClosepanicpanicClose succeeds; buffered values can be read. After buffer drains, further reads return the zero value of the channel type.Close succeeds; further reads return the zero value of the channel type.
ReceiveBlockNon-blocking; returns the zero value of the channel typeNon-blocking; reads values normallyBlock
SendBlockpanicNon-blocking; writes values normallyBlock

Compile-time rules

OperationChannel typeResult
ReceiveSend-only channelCompile error
SendReceive-only channelCompile error
CloseReceive-only channelCompile error