A buffered channel is a Go channel with a bounded queue. Create one with make, choosing its element type and capacity; sends proceed until that capacity is full. section 7.2.3
Use buffering to control when concurrent work blocks:
- A send to a channel with available capacity stores the value without an immediately corresponding receive. section 7.2.3
- A full buffer blocks the sending goroutine until a receiver removes a value; reads preserve first-in, first-out order. section 7.2.3
- Choose capacity from the number of values written before reading starts, or benchmark it for the target workload and machine. section 7.5.2 section 9.7
Starting a concurrent maze solver
An unbuffered pathsToExplore channel blocks when Solve publishes the entrance before listening begins. Giving it a one-value buffer allows the initial path to be published, though the listener still needs a termination condition. A test instead uses make(chan *path, 3) so explore can publish three candidates while the test inspects the queue. section 9.3.4 section 9.3.6
c := make(chan int, 10) #1 c := make(chan int) #2
Compare buffered and unbuffered construction, then inspect send and receive syntax through the channel examples. section 7.2.3


