Hacker News new | ask | show | jobs
by sethvargo 1601 days ago
Right, which is noted in the post. That verbosity is, well, verbose. I generally need this in 20% of things I write.
1 comments

In this use case, is it bad if the Done signal arrives the instant after you check it?
The context was introduced by the commenter. The original post does not use contexts. In general, there's a pretty common set of patterns in which multiple goroutines are writing data to different channels, and you need to ensure the data from those channels are processed with some level of priority.
Two channels is a poor way to handle priority. If data comes in on the low priority channel just before the high priority channel, you would still be blocked waiting for the low priority task to complete.

In a case like this, maybe just run two different consumer routines for the two channels, then neither would be blocked waiting on the other.