6 ms·
It's only enabled for modules that run Go 1.22 and higher
by matthewmueller 3y ago
It's only enabled for modules that run Go 1.22 and higher
- badrequest 3y agoI also can't imagine a case where it is useful or even truly intended to rely on this behavior.
- omginternets 3y agoYeah it’s def a code smell …
- ben0x539 3y agoYeah I don't think it's so much "we explicitly rely on this behavior, how dare you change this" as "somewhere in our mountains of maintenance-mode code that haven't seen the sun shine through an editor window in years, this behavior cancels out another bug that we never noticed". Tooling should be able to detect when code relies on this, but it's still gonna cost some non-zero amount of developer effort to touch ancient code and safely roll out a new version if it needs to be actively addressed.
- rsc 3y agoIf you have tests and they break with GOEXPERIMENT=loopvar, then there is a new tool that will tell you exactly which loop is causing the breakage. That's a post for a few weeks from now.
- kuchenbecker 3y agoIf
- Cthulhu_ 3y agoNeither can I, but there may be cases of code accidentally relying on it - there's an adage that I forgot the name of that says just that, and I think compiler manufacturers are the most aware of that adage.