Re:Conc: Better Structured Concurrency for Go
by klodolph on Wednesday January 11, 2023 @06:01PM
(#34346334)
Old habits die hard. For what it’s worth, the bugs I saw were long before the 1.14 release. Somewhere around 1.7 or something.
Re:Conc: Better Structured Concurrency for Go
by morelisp on Wednesday January 11, 2023 @06:02PM
(#34346348)
Agreed - it's also not nearly as clear for `ctx, cancel := ...; defer cancel()` and I see that reflex in a few places where it's not only often much less efficient, but logically wrong / less safe.
Re:Conc: Better Structured Concurrency for Go
by klodolph on Wednesday January 11, 2023 @06:06PM
(#34346402)
What issues do you see with defer cancel()?
Re:Conc: Better Structured Concurrency for Go
by preseinger on Wednesday January 11, 2023 @06:28PM
(#34346591)
I think the OP is saying defer cancel() is correct, and the stuff people would do to avoid it are the things that are bad.
Unfortunately this was not the case before 1.14, so there's a lot of "middle-aged" code floating around setting a bad example.