They are not universally a bad thing, but total avoidance of sync package primitives is a bad idea (and much slower in many circumstances)
This gives a good analysis:
https://www.jtolio.com/2016/03/go-channels-are-bad-and-you-s...
They are not universally a bad thing, but total avoidance of sync package primitives is a bad idea (and much slower in many circumstances)
This gives a good analysis:
https://www.jtolio.com/2016/03/go-channels-are-bad-and-you-s...
> Now that goroutine needs to be closed, then you end up with an additional close channel
Goroutines that just map values or similar will usually share a context with some other goroutine and can therefore reuse that context's close channel.
So, having a context is still "end[ing] up with an additional close channel" as silasdavis said. Even if you pass it to something that will be cancelled like a network operation, you still must correctly notice and handle the resulting timeout error.
The value for context is almost entirely that everybody in the community has come to agree on it rather than its functionality per se. Which is the same as io.Reader, in that the utility isn't its functionality, which any number of languages can replicate, but the way everybody agrees to implement and use it through the entire ecosystem, which is where other languages have a lot more trouble. Nothing technically stops that from happening, but you often end up with islands of agreement in different major frameworks or library ecosystems instead of ecosystem-wide agreement. Context is everywhere now; it's actually been a few months since I encountered a place I wish that took it that didn't.