Not planned
Description
@taking requested issue #68658 to be considered for backport to the next 1.22 minor release.
@gopherbot please backport this to 1.22. It's necessary to have consistent file versions with build tags with later versions.
Metadata
Metadata
Assignees
Type
Projects
Relationships
Development
No branches or pull requests
Activity
gabyhelp commentedon Oct 2, 2024
Related Issues and Documentation
(Emoji vote if this was helpful or unhelpful; more detailed feedback welcome in this discussion.)
timothy-king commentedon Oct 2, 2024
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.
gabyhelp commentedon Oct 2, 2024
Related Issues and Documentation
(Emoji vote if this was helpful or unhelpful; more detailed feedback welcome in this discussion.)
[-]cmd/go: breaking change in 1.23rc2 with version constraints in GOPATH mode [1.22 backport] #69094[/-][+]cmd/go: breaking change in 1.23rc2 with version constraints in GOPATH mode [1.22 backport][/+]timothy-king commentedon Oct 4, 2024
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:
timothy-king commentedon Oct 5, 2024
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.
timothy-king commentedon Oct 8, 2024
Moving from
cmd/go
review status to 'waiting on weekly review' and removing from CLI triage. This is ago/types
decision.[-]cmd/go: breaking change in 1.23rc2 with version constraints in GOPATH mode [1.22 backport][/-][+]go/types, cmd/go: breaking change in 1.23rc2 with version constraints in GOPATH mode [1.22 backport][/+]cherrymui commentedon Oct 11, 2024
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.
timothy-king commentedon Oct 11, 2024
So with some additional prodding and admittedly very strange choices, one can lift this to a compiler problem:
This builds with
go1.20.14
andgo1.23.1
while it fails to build withgo1.21.13
andgo1.22.7
: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.
cherrymui commentedon Oct 11, 2024
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.
prattmic commentedon Oct 23, 2024
Given the lack of user-reported issues, we've decided not to backport.