-
Notifications
You must be signed in to change notification settings - Fork 18k
go/types, cmd/go: breaking change in 1.23rc2 with version constraints in GOPATH mode [1.22 backport] #69749
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
CC @griesemer . https://go.dev/cl/615685 has some helpful context on why FileVersions from go/types has a different meaning in 1.22 and should maybe be updated. |
Example that shows the discontinuity between 1.22 and 1.23:
1.23 says this type checks. 1.22 says this does not type check with the following error:
|
https://go.dev/cl/617635 has more examples where go/types.Info.FileVersions has a different meaning in 1.22. Back porting would mean FileVersions would have a single consistent semantics going forward. This is also not a trivial backport or an issue that impacts many users directly. It may not be worth the risk. But THB if someone came up and asked me how to use go/types.Info.FileVersions correctly, I would at this point tell them to skip to 1.23 or to only use it for the specific check 'is this file >= 1.22 or unknown (until you stop supporting 1.22)'. This way they could skip needing to specialize for both cases. So we need to decide if we are going to accept go/types producing different FileVersion values as Unfortunate or to back port. |
Moving from |
Discussed in the release meeting, we thought that that this is a subtle edge case that doesn’t seem to be causing problems for most users (if one wants 1.21 feature, they probably shouldn't use 1.18 build tag). So this is mostly potentially for tool authors? But we haven’t heard external reports so far. So might not be worth the risk of backporting fairly late in the 1.22 cycle. @timothy-king what do you think? Thanks. |
So with some additional prodding and admittedly very strange choices, one can lift this to a compiler problem:
This builds with
There are multiple odd choices in this example: a 1.16 build tag, using a 1.18 feature, and using go1.20.14 with a go1.21 module. But still not backwards compatible in the strictest sense. A working example stopped compiling even if it is an edge case. TBH the bit I really want to fix is that I want a simpler world where FileVersions has one meaning and the current 1.22 meaning is a bug. This is an obnoxious bit of tech debt I would like to get rid of. It may not be worth the risk though as you said. I'll let other decide. |
Yes, this can leads to a compilation failure. But using 1.18 feature with a 1.16 build tag seems a bad choice, and is probably really are. It doesn't seem too bad that this doesn't compile with Go 1.22, given that this would also not compile with Go 1.21. |
Given the lack of user-reported issues, we've decided not to backport. |
@taking requested issue #68658 to be considered for backport to the next 1.22 minor release.
The text was updated successfully, but these errors were encountered: