Skip to content
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

Open
rsc opened this issue Mar 9, 2024 · 6 comments
Open

cmd/go: list confuses imports #66218

rsc opened this issue Mar 9, 2024 · 6 comments
Labels
GoCommand cmd/go NeedsFix The path to resolution is known, but the work has not been done. release-blocker
Milestone

Comments

@rsc
Copy link
Contributor

rsc commented Mar 9, 2024

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.

% go list -f '{{.Dir}} {{.Imports}}' std |grep /src/math/rand
/Users/rsc/go/src/math/rand [internal/godebug math sync sync/atomic unsafe]
/Users/rsc/go/src/math/rand/v2 [errors internal/chacha8rand math math/bits unsafe]
% go list -f '{{.Dir}} {{.Imports}}' std cmd |grep /src/math/rand 
/Users/rsc/go/src/math/rand [internal/godebug [cmd/compile] math [cmd/compile] sync [cmd/compile] sync/atomic [cmd/compile] unsafe [cmd/compile]]
/Users/rsc/go/src/math/rand/v2 [errors internal/chacha8rand math math/bits unsafe]
% 
@rsc rsc added NeedsFix The path to resolution is known, but the work has not been done. release-blocker labels Mar 9, 2024
@rsc rsc added this to the Go1.23 milestone Mar 9, 2024
@adonovan
Copy link
Member

@findleyr I wonder whether this is the source of a number of the metadata inconsistency problems we've been seeing in gopls.

@timothy-king
Copy link
Contributor

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.

@findleyr
Copy link
Contributor

findleyr commented Mar 11, 2024

@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.

@bcmills bcmills added the GoCommand cmd/go label Mar 11, 2024
@aclements
Copy link
Member

It does seem quite likely this is related to PGO.

@aclements
Copy link
Member

git checkout go1.21.0 && git qbisect --from go1.20 --setup ./make.bash zsh -c "go list -f '{{.Dir}} {{.Imports}}' std cmd |grep /src/math/rand | grep 'math sync'" says 45b74d2, which confirms PGO, but otherwise isn't very helpful.

@thanm
Copy link
Contributor

thanm commented Mar 27, 2024

Wondering what is happening with this bug (during weekly release checkin meeting). Any updates?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
GoCommand cmd/go NeedsFix The path to resolution is known, but the work has not been done. release-blocker
Projects
None yet
Development

No branches or pull requests

7 participants