4 ms·
It is not that simple. For some Go scripts without go.mod involved, Go 1.22.n toolchains break backward compatibility for sure. Go core team have admitted this
by tapirl 2y ago
It is not that simple.
For some Go scripts without go.mod involved, Go 1.22.n toolchains break backward compatibility for sure. Go core team have admitted this but refused to fix it for Go 1.22.n toolchains: https://github.com/golang/go/issues/66092 https://github.com/golang/go/issues/66092
And, even for the Go code with go.mod involved, there are some behavior change cases which will be not detected in time when you update the Go version in go.mod. Please read https://go101.org/blog/2024-03-01-for-loop-semantic-changes-in-go-1.22.html https://go101.org/blog/2024-03-01-for-loop-semantic-changes-... for such cases. Now, no tools can detect some of the cases.
The more serious problem than behavior changes is, with the new 3-clause "for;;" loop semantics, it is more error-prone to use loop variables. Making the semantic change (on 3-clause "for;;" loop) might be the worst decision made in Go history.
- foldr 2y agoYou've made your point about the new for loop behavior many times. As others have also pointed out, people just don't agree with you about this. They're not going to suddenly start agreeing if you keep posting the same thing over and over again. (Now that I type this out I'm sure I could stand to learn the same lesson on a few topics!)
- tapirl 2y agoThe facts in my comments are for the people who need them. Maybe you are not one of them. But then why do you so care about it?
- linhns 2y agoHow many go scripts nowadays come without go.mod? I would hazard a guess of only 0.00001%. And since it’s without go.mod, it shouldn’t be used anyway.
- tapirl 2y agoFirst, Go Official has never expressed the same opinion as you officially. In fact, the "go run GoSourceFilesWithoutGoDotModFile" command is still supported in 1.22 and latest Go toolchain versions. Second, the idea that rarity deserves to be ignored is flawed logic and shows a lack of respect.