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: 'go vet cmd' fails with "use of internal package" when run in GOROOT/src/cmd #42235

Open
bcmills opened this issue Oct 27, 2020 · 0 comments
Labels
Analysis Issues related to static analysis (vet, x/tools/go/analysis) GoCommand cmd/go NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one.
Milestone

Comments

@bcmills
Copy link
Contributor

bcmills commented Oct 27, 2020

~/go-review/src/cmd$ go version
go version devel +320cc79002 Tue Oct 27 12:36:54 2020 +0000 linux/amd64

~/go-review/src/cmd$ go vet cmd
package cmd/vendor/github.com/google/pprof/driver
        vendor/github.com/google/pprof/driver/driver.go:24:2: use of internal package github.com/google/pprof/internal/driver not allowed
package cmd/vendor/github.com/google/pprof/driver
        vendor/github.com/google/pprof/driver/driver.go:25:2: use of internal package github.com/google/pprof/internal/plugin not allowed
…

~/go-review/src/cmd$ cd ..

~/go-review/src$ go vet cmd

~/go-review/src$

I'm not actually sure whether this bug is in cmd/go or in cmd/vet.

There was a similar issue (#41358) in cmd/api which we resolved by omitting the vendored packages. However, in this case I think we really should be running vet on these packages — we just need to get go vet to interpret the imports from within those packages correctly.

This comment in cmd/go is related:

// Do the same for importers beginning with the prefix 'vendor/' even if we
// are *inside* of the 'std' module: the 'vendor/' packages that resolve
// globally from GOROOT/src/vendor (and are listed as part of 'go list std')
// are distinct from the real module dependencies, and cannot import
// internal packages from the real module.

CC @matloob @jayconrod

@bcmills bcmills added NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. GoCommand cmd/go labels Oct 27, 2020
@bcmills bcmills added this to the Backlog milestone Oct 27, 2020
@timothy-king timothy-king added the Analysis Issues related to static analysis (vet, x/tools/go/analysis) label Jan 26, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Analysis Issues related to static analysis (vet, x/tools/go/analysis) GoCommand cmd/go NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one.
Projects
None yet
Development

No branches or pull requests

2 participants