-
Notifications
You must be signed in to change notification settings - Fork 17.3k
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
cmd/go: list confuses imports #66218
Comments
@findleyr I wonder whether this is the source of a number of the metadata inconsistency problems we've been seeing in gopls. |
I also wonder whether this is related to the various ssa panics that go away when compiling with 1.22 (#65608). That could be explained by a go list inconsistency for a package. |
@adonovan while it does look like there's a bug in cmd/go, I believe for this specific case we won't encounter that bug in go/packages as we disabled PGO in go list in https://go.dev/issue/60456. |
It does seem quite likely this is related to PGO. |
|
Wondering what is happening with this bug (during weekly release checkin meeting). Any updates? |
@matloob Are there updates on this? This is currently a blocker for Go 1.23 RC 1. Is this important enough to be considered a release blocker for Go 1.23? |
No updates yet. I plan to look at this next week. |
@matloob Is there is status update on this issue? This came up in the release meeting. |
Not yet. I plan to start looking tomorrow. |
So it looks like what's happening is that while when we split off the pgo variant of a package, while we clone the Internal.Imports slice so that the actual import links between packages are different, we don't do the same thing for the (non-internal) Imports field. See go/src/cmd/go/internal/load/pkg.go Line 2948 in 1c92457
The split code is does the following
where So the pgo and non pgo variants share the same (PackagePublic) Imports slice. When the list code updates the package public Imports, it then ends up modifying the original too. |
Change https://go.dev/cl/588275 mentions this issue: |
go list std cmd should show information about the standard math/rand package, but it seems to only show information for math/rand compiled for cmd/compile, or at least with dependencies compiled for cmd/compile.
This bug appears to have been introduced between Go 1.20 and Go 1.21.0. I have not bisected further.
The text was updated successfully, but these errors were encountered: