A buffered channel is a Go channel with finite message storage. A sender continues without an immediate receiver while capacity remains; a receiver continues while queued messages remain. Messages reach receivers in send order. section 7.1.2 section 7.4
Its behavior follows the buffer’s state:
- An available slot lets a send proceed and queues the message. section 7.1.2
- A full buffer blocks the sender until a receiver consumes a message. section 7.1.2
- A receiver drains queued messages even after sending has stopped. section 7.1.2
- An empty buffer blocks the receiver until another message arrives. section 7.1.2
A fast producer and slow receiver
Create msgChannel with capacity three, start a receiver that sleeps for one second between reads, and send six integers followed by -1. The first messages enter the buffer quickly; later sends wait as the receiver frees space. The receiver prints 1 through 6, then -1, while a wait group coordinates completion.


