-
Notifications
You must be signed in to change notification settings - Fork 17.8k
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
all: audit x/ repos for gotypesalias settings #69772
Comments
Go repos to audit:
|
Gaby didn't include it in #69772 (comment), but issue #67791 is also related here. If there are tests in x/ repos that would fail when switching to the eventual new default of gotypesalias=1, that builder would report it. |
Excluding gofrontend, there are 60 matches and out of these 25 are in x/tools. x/{tools,vuln,vulndb} are fairly easy to address. The rest give me some pause though. The right thing to do here might just be to update go/types to avoid this. |
Can you say more? You mean back porting additional logic to 1.22.x? |
Sure. 1.24 could materialize *types.Alias values when # type params > 0 and the GOEXPERIMENT is on. Basically ignore the GODEBUG flag for this case. This is backwards compatible with pre 1.24 code. Users of go/types with go.mod files at 1.22 may still need to update their tools to support *types.Aliases coming from 1.24 code, but they would not need to apply the a change like https://go.dev/cl/618676. They would not see an error from go/types. A proposal would be needed to change the godebug wording. The advantage is changes like this are unnecessary (in particular for users are not us). |
Change https://go.dev/cl/619395 mentions this issue: |
Set gotypesalias=1 when using >=1.23 toolchain on all of the main packages in x/tools that use go/types. Does not include packages that are ignored due to build tags. This effectively upgrades commit https://go.dev/cl/617095. For golang/go#69772 Change-Id: I434c280b928ad21e1fd9c7f880e1324c14741dc3 Reviewed-on: https://go-review.googlesource.com/c/tools/+/619395 Reviewed-by: Robert Findley <rfindley@google.com> Commit-Queue: Tim King <taking@google.com> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Change https://go.dev/cl/627715 mentions this issue: |
Set gotypesalias=1 when using >=1.23 toolchain on all of the main packages in x/tools that use go/types. This effectively upgrades commit https://go.dev/cl/617095. For golang/go#69772 Change-Id: I9f3e64d348f6bffc75321a08145fde07fb4024a6 Reviewed-on: https://go-review.googlesource.com/c/vuln/+/627715 LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Zvonimir Pavlinovic <zpavlinovic@google.com>
golang.org/x/playground uses go/types only via golang.org/x/tools/imports. My manual inspection golang.org/x/tools/imports is not sensitive to this setting. |
golang.org/x/website uses go/types only via golang.org/x/tools/imports and runtime.test. |
For golang.org/x/exp/cmd/{apidiff,gorelease} the dependency on go/types is through golang.org/x/exp/apidiff. golang.org/x/exp/cmd/apidiff tests fail when gotypesalias=1 is enabled. So it looks like golang.org/x/exp/apidiff needs to be updated for types.Alias. |
golang.org/x/text takes underlying types in message/pipeline/extract.go. So this likely needs to be updated to support 1.24 or an expert on the code needs to do a thorough audit. |
The main packages in golang.org/x/exp/typeparams are examples for illustration purposes only. These do not take input. They are thus not a concern. |
Issues have been filed for the remaining investigations/work. Audit of the packages is done. Nothing remaining seems like a blocker for 1.24. |
This item is to track auditing and then updating all of the x/ repos for correctly setting the
gotypesalias
GODEBUG setting in preparation for 1.24.main
packages in 1.22 modules (e.g. x/tools/cmd/callgraph) will default to the value ofgotypesalias=0
. If these packages usego/types
and are built with a 1.24 toolchain, they will havegotypesalias=0
. Such binaries will not create the*types.Alias
value that is required to create an alias with type parameters (#46477). Effectively any such binaries would be unable to properly support 1.24 despite using the 1.24 compiler and standard library.My proposed plan is to:
//go:debug gotypesalias=0
. (See https://go.dev/cl/617095 for an example.)//go:debug gotypesalias=0
for what to do. A good default action is to update these packages to enableGODEBUG=gotypesalias=1
when built with >=1.23 toolchains (see https://go.dev/cl/617636).cc @aclements , @cherrymui , @findleyr, @griesemer , @adonovan , @dmitshur
The text was updated successfully, but these errors were encountered: