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/go/packages: cannot load "cmd" from within a module #29913

Open
mvdan opened this issue Jan 24, 2019 · 3 comments

Comments

@mvdan
Copy link
Member

commented Jan 24, 2019

$ go version
go version devel +9d23975d89 Wed Jan 23 23:13:03 2019 +0000 linux/amd64
$ git describe --always
6466e726
$ go install ./gopackages
$ gopackages cmd >/dev/null; echo $?
0
$ mkdir /tmp/tempmodule
$ cd /tmp/tempmodule
$ go mod init tempmodule
go: creating new go.mod: module tempmodule
$ gopackages cmd >/dev/null; echo $?
gopackages: go list repeated package github.com/google/pprof/internal/driver with different values
2

This seems pretty serious - I'm having trouble using a linter that I wrote as it's now running into these errors. Perhaps related to #29826, but in this case the packages don't seem to be identical, as DeepEqual returns false.

/cc @matloob @ianthehat

@mvdan

This comment has been minimized.

Copy link
Member Author

commented Jan 24, 2019

Seems like the issue is that it's loading the vendored packages as modules:

$ cat go.mod
module tempmodule

go 1.12

require (
        github.com/google/pprof v0.0.0-20190109223431-e84dfd68c163 // indirect
        github.com/ianlancetaylor/demangle v0.0.0-20181102032728-5e5cf60278f6 // indirect
        golang.org/x/arch v0.0.0-20181203225421-5a4828bb7045 // indirect
        golang.org/x/crypto v0.0.0-20190123085648-057139ce5d2b // indirect
        golang.org/x/sys v0.0.0-20190124100055-b90733256f2e // indirect
        golang.org/x/tools v0.0.0-20190124004107-78ee07aa9465 // indirect
)

I'm starting to wonder if this is supposed to be broken. Still, I presume there's something to fix; the error is confusing.

Edit: as expected, GO111MODULE=off gopackages cmd always works. I'll be using this as a workaround for now.

@bcmills

This comment has been minimized.

Copy link
Member

commented Jan 24, 2019

Dup of #26924, or at least closely related.

@mvdan

This comment has been minimized.

Copy link
Member Author

commented Jan 24, 2019

Perhaps. The errors we end up with seem different, so I'm not sure if we should close this issue as a duplicate.

@mvdan mvdan changed the title go/packages: cannot load "cmd" from within a module x/tools/go/packages: cannot load "cmd" from within a module Jan 24, 2019

@gopherbot gopherbot added this to the Unreleased milestone Jan 24, 2019

@bcmills bcmills added the modules label Jan 24, 2019

@bcmills bcmills self-assigned this Mar 1, 2019

@gopherbot gopherbot added the Tools label Sep 12, 2019

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
3 participants
You can’t perform that action at this time.