Re:The borrowchecker is what I like the least about Rust
by binary132 on Sunday July 20, 2025 @07:40AM
(#44624207)
The answer to your question is zero, unless there is a compelling reason for it to buffer, and if there is you’ll know it.
Non-buffering channels are much simpler to reason about and have very useful semantics in pipelines.
I think channels have too many footguns (what should its size be? closing without causing panics when there are multiple writers), thus it's definitely better "abstracted out" at the framework level. Most channels that developers interact with is the `Context.Done()` channel with <-chan struct{}.
Also, I'm not sure whether the go authors originally intended that closing a channel would effectively have a multicast semantics (all readers are notified, no matter how many are); everything else have pub-sub semantics, and turns out that this multicast semantics is much more interesting.