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

x/tools: internal error: go list gives conflicting information #34294

Closed
kevinburke1 opened this issue Sep 14, 2019 · 11 comments
Closed

x/tools: internal error: go list gives conflicting information #34294

kevinburke1 opened this issue Sep 14, 2019 · 11 comments
Labels
FrozenDueToAge Tools This label describes issues relating to any tools in the x/tools repository.
Milestone

Comments

@kevinburke1
Copy link

kevinburke1 commented Sep 14, 2019

While running staticcheck (at tip) using Go tip (8cc57c0) with x/tools at tip (0240832), I repeatedly got this error message:

internal error: go list gives conflicting information for package github.com/acme/server/src/cmd/server [github.com/acme/server/src/cmd/server.test]

I'm using a Mac latest version.

  • github.com/acme/server/src/cmd/server is a main package that imports github.com/acme/server/src and other packages.

  • github.com/acme/server/src is a library with package name package server.

I cleaned every cache I could find and could still reproduce the problem. I could not reproduce using Go 1.13.

Along the way I noticed that some files were importing github.com/BurntSushi/toml and some files were importing github.com/burntsushi/toml. I fixed this problem - using BurntSushi/toml everywhere - but still got the same error afterwards.

That's all the debugging information I have the time to provide at this point, sorry.

@gopherbot gopherbot added this to the Unreleased milestone Sep 14, 2019
@gopherbot gopherbot added the Tools This label describes issues relating to any tools in the x/tools repository. label Sep 14, 2019
@kevinburke1
Copy link
Author

I cannot reproduce at commit 396d625, so maybe I can bisect if I have time.

@ianthehat
Copy link

That message implies that in a single call to go list the json result had more than one entry for the same import path, and that those two entries disagreed about what that import path represented.
The thing it prints after the message is the import path, which implies that it thinks the problem is with the test variant of github.com/acme/server/src/cmd/server, do you have a main_test?
try running with GOPACKAGESDEBUG=true and see the exact go list command it is invoking, and then run that go list by hand to see what it does?

@kevinburke1
Copy link
Author

Yes, I have a main_test, though I tried deleting the file and moving the test contents to acme/server/src/server_test.go and was still able to reproduce.

I'm bisecting now.

@kevinburke1
Copy link
Author

I can reproduce with 24781a1 and I cannot reproduce with 79877e5 so I believe 24781a1 is the offending commit.

@ianthehat
Copy link

I really need to see the go list invocation and what it prints to work out why
If you set GOPACKAGESDEBUG=true in your environment, go/packages gets nice and noisy

@kevinburke1
Copy link
Author

2019/09/14 03:00:56 18.409854ms for GOROOT=/Users/kevin/go GOPATH=/Users/kevin GO111MODULE=on PWD=/Users/kevin/src/github.com/acme/server go "env" "GOMOD", stderr: <<>>
2019/09/14 03:00:56 22.336353ms for GOROOT=/Users/kevin/go GOPATH=/Users/kevin GO111MODULE=on PWD=/Users/kevin/src/github.com/acme/server go "list" "-m" "-json" "all", stderr: <<>>
2019/09/14 03:00:57 290.0404ms for GOROOT=/Users/kevin/go GOPATH=/Users/kevin GO111MODULE=on PWD=/Users/kevin/src/github.com/acme/server go "list" "-e" "-json" "-compiled=true" "-test=true" "-export=true" "-deps=true" "-find=false" "--" "./...", stderr: <<>>
internal error: go list gives conflicting information for package github.com/acme/server/src/cmd/server [github.com/acme/server/src/cmd/server.test]

@ianthehat
Copy link

So if you run that third command by hand, it should print a whole bunch of JSON for us?

@kevinburke1
Copy link
Author

Yes, I don't feel super comfortable pasting the output in a public channel though. I will mail to the email address in your profile shortly.

@kevinburke1
Copy link
Author

Just sent.

@ianthehat
Copy link

After talking to you offline it is a duplicate of #34321 so I am going to close this bug in favor of that one. Thanks for all your help isolating this!

@abustany
Copy link

Note for future people getting this error, for example while running golangci-lint: this also happens if you have an import cycle in your packages (including test ones). go test will print an appropriate error message, but loading packages with go/packages won't.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
FrozenDueToAge Tools This label describes issues relating to any tools in the x/tools repository.
Projects
None yet
Development

No branches or pull requests

4 participants