-
Notifications
You must be signed in to change notification settings - Fork 17.7k
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
x/tools/go/packages: gotypesalias=1 does not seem to get used correctly for deps on Go 1.23 #70394
Comments
I didn't spend the time bisecting why this works on Go master (1.24). I suppose it could be because alias tracking is always on at this point, or perhaps due to other changes in how export data is generated or loaded. |
Change https://go.dev/cl/629997 mentions this issue: |
The issue locates inside the Tool go/src/cmd/compile/internal/importer/ureader.go Lines 34 to 36 in 777f43a
Then the result is read by I'm still new to the cmd/compile part and don't know a lot of things, so it's possible I've missed something important. I would appreciate any corrections or guidance. Thanks a lot! Regarding on the CL629997, I don't know the following things but I will try to check them tomorrow. Updated in 21Nov
|
Great find. I suspected it was something like this, but narrowing it down is super helpful. I will follow up on this. |
That would also explain why 1.24 (master) did not have this bug, as I recall some rather large import/export changes in the compiler. |
Change https://go.dev/cl/631855 mentions this issue: |
Change https://go.dev/cl/632116 mentions this issue: |
I think the milestone for this issue is not right by the way - this issue affects 1.23.x only, not 1.24, so it should probably be milestoned for the next 1.23.x release. |
@mvdan This issue can indeed be marked as closed since it's resolved in Go 1.24, but the Go1.24 milestone is right. There is a child backport issue (#70517 in this case) that needs to refer to this one. We need this parent issue for tracking of any remaining development (e.g., like for CL 632116 which adds a test), even if the problem happened to be fixed before the issue was filed. See https://go.dev/wiki/MinorReleases, which includes "As soon as an interested party thinks an issue should be considered for backport, they open one or two “child” issues titled like package: title [1.17 backport]. The issue should include a link to the original issue and a short rationale about why the backport might be needed." and more details. |
For a 1.22 backport, we would need to backport most of https://go.dev/cl/579935, https://go.dev/cl/585399, and possibly other subsequent CLs that build on top of these and fix bugs. These would not be "100% clean" backports either as public APIs are involved and differ between releases. Given the relatively low volume of user complaint, the complexity/risk of the backport, and hopefully soon availability of a 1.23 fix, I am not sure a 1.22 backport makes sense at this time. |
All I need is a backport to 1.23, personally. |
Adds a unit test that reproduces golang/go#70394. That issue is for 1.23 only. The test currently requires >=1.24 so it can pass until there is a backport. Updates golang/go#70394 Change-Id: I35b716d051dd3e737b4db15c3ac871d3166abfca Reviewed-on: https://go-review.googlesource.com/c/tools/+/632116 Reviewed-by: David Chase <drchase@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/633695 mentions this issue: |
Change https://go.dev/cl/633698 mentions this issue: |
Change https://go.dev/cl/633735 mentions this issue: |
Also add back the x/tools replace directive for gopls. For golang/go#70301 Merge List: + 2024-12-04 7eebab3 gopls/internal/golang: support extract variable at top level + 2024-12-04 e334696 gopls/internal/golang: ignore effects for change signature refactoring + 2024-12-04 3901733 internal/refactor/inline: substitute groups of dependent arguments + 2024-12-03 61b2408 gopls/internal/golang: add "Extract constant" counterpart + 2024-12-03 c01eead internal/gcimporter: require binary export data header + 2024-12-03 9a04136 gopls/internal/golang/stubmethods: refine crash into bug report + 2024-12-03 01e0b05 internal/refactor/inline: fix condition for splice assignment strategy + 2024-12-03 557f540 gopls/internal/golang: don't offer to move variadic parameters + 2024-12-03 399ee16 internal/gcimporter: update FindExportData to return a non-negative size + 2024-12-03 25b0003 internal/refactor/inline: more precise redundant conversion detection + 2024-12-03 eb46939 gopls/internal/test/marker: add reproducers for moveparam bug bash bugs + 2024-12-03 4296223 gopls/internal/analysis/yield: add comment about dataflow + 2024-12-03 7a4f3b0 internal/gcimporter: require archive files + 2024-12-02 2f73c61 gopls/internal/golang: avoid crash in lookupDocLinkSymbol + 2024-12-02 ef3d603 gopls/internal/golang/completion: fix crash with extra results + 2024-12-02 8ffeaba gopls/internal/settings: enable 'waitgroup' analyzer + 2024-12-02 4317959 go/analysis/passes/waitgroup: report WaitGroup.Add in goroutine + 2024-12-02 72fdfa6 gopls/internal/golang: Disable test generation for generic functions + 2024-12-02 b80f1ed gopls/internal/analysis/yield: peephole-optimize phi(false, x) + 2024-11-28 e7bd227 gopls/internal/golang: fix folding range for function calls + 2024-11-28 e71702b internal/versions: remove constraint.GoVersion wrapper + 2024-11-28 c99edec gopls/internal/golang/completion: add alias support for literals + 2024-11-27 bfe3046 go/packages: add a unit test for golang/go#70394 + 2024-11-27 df87831 gopls/internal/undeclaredname: add missing colon when appropriate + 2024-11-26 53efd30 gopls/internal/golang: simplify package name collection in add test Change-Id: I476e80493f61732701784befe2b130ca967b259e
Take the testscript below:
With https://pkg.go.dev/github.com/rogpeppe/go-internal/cmd/testscript, I see:
The first two results seem wrong; alias tracking is lost for the transitive dependency, given that we see the alias target
int64
rather than the alias declared in the transitive dependency,pkg2.Alias2
. This happens whether or not I set the GODEBUG flag, which should already be on by default in Go 1.23.The issue only goes away once I set
NeedSyntax
, which presumably forces the current process to parse and typecheck all packages directly, rather than relying on the Go toolchain to typecheck transitive dependencies and store the results in GOCACHE, for the current process to load from a warm cache.This bug seems to go away as of
go version devel go1.24-493edb2973 2024-11-16 15:10:05 +0000 linux/amd64
:The text was updated successfully, but these errors were encountered: