Buffered channels
Buffered channels are channels that have a bounded size. They are typically more performant than their unbounded counterparts. They are useful for retrieving values from an explicit number of goroutines that you've launched. Because they are FIFO (first in first out) queueing mechanisms, they can effectively be used as a fixed-size queueing mechanism, and we can process requests in the order in which they came in. Channels are created before they are used by invoking the make() function. Once a buffered channel is created, it is ready and available for use. Buffered channels don't block on incoming writes if there is still room in the channel. It's important to remember that data flows in the direction of the arrow within ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access