News for hackers. Stuff that matters.
Re:Buffered Channels in Go: Tips and Tricks by kasey_junk on Tuesday January 16, 2018 @08:56AM (#16158143)
It’s worth noting that eliminates the range option which means you need to handle all the edge cases around closed/nil channels by hand.

On the publish side in most production cases you don’t want to use time.after as it leaks. So you’ll use either a context or a timer.

All told it’s a fair bit of boilerplate to get right everytime (which you can’t genericize) which is why I tend to use buffered channels that are sized such that being full is a degenerate case.

There are no comments on this comment yet.