Re:Portable Cloud Programming with Go Cloud
by ironjunkie on Tuesday July 24, 2018 @02:17PM
(#17603632)
yeah, that context thing is a huge mess.
The libraries that support it have now all their function signature way longer, and it is not well understood if it is a "Request for cancellation" or something else
Re:Portable Cloud Programming with Go Cloud
by atombender on Wednesday July 25, 2018 @07:34AM
(#17608453)
Context is a pet peeve of mine. It's a design mistake as implemented, even if it serves an important function. It infects everything, forcing every method to pass contexts around, and it conflates multiple separate concerns (cancellation, deadlines, and key/value data).
Given that all of a Go program sooner or later will need contexts somewhere, it would be much cleaner to let goroutines have this stuff implicitly. I don't know enough about the intervals to say whether this is feasible with the current runtime, though.
People really seem to dislike context in the standard library too:
It also seems to be one of the biggest points of controversy for Go 2, with calls from "everything should have a context" to "context should go away".