A buffered channel holds a specified number of values, allowing producers and consumers to work at different paces. A send blocks when the buffer is full and resumes when a value is received and space becomes available. section 9.4
Buffering articles
A feed fetcher can send articles to a channel while a separate goroutine saves them. Increasing the channel capacity lets the fetcher queue multiple articles instead of waiting for each receive. The capacity limits queued values, not necessarily articles still being processed. section 9.4
func (a *App) fetchFeed(ctx context.Context, url string) {
...
fmt.Println("fetched: ", url)
out := make(chan *gofeed.Article, 10) #1
go a.saveFeed(out)
...
}
The second argument to make sets the article channel’s capacity to 10; saveFeed consumes values concurrently. section 9.4
A buffered channel can also serve as a shared work queue. A worker pool submits feed URLs to the channel, and workers receive URLs from that common queue. Buffering separates submission from execution until the queue fills; more workers can process feeds concurrently. section 9.5.1


