x/tools/go/packages: pass overlay to all invocations of go list
#67644
Labels
Tools
This label describes issues relating to any tools in the x/tools repository.
Milestone
As part of my analysis tests, I have the following
testdata
structure:Each directory in
testdata
specifies the Go language version to test with and is conceptually its own Go module. I don't want to check in actualgo.mod
files, so instead I use go/package's overlays to synthesize them. The vendor directory contains stubs for third party packages that my analyses have special handling for. Because I specify Go versions older than 1.14, I also setGOFLAGS=-mod=vendor
to explicitly enable vendoring.packages.Config.Dir
is set to these modules, e.g.testdata/go1.0
.go/packages
invokesgo list
three times:Only the third call passes the overlay. The second call runs with modules enabled, but without the overlay. However, it still sees GOFLAGS=-mod=vendor.
go
now walks up the directory tree to find the outer, real module and complains about its "inconsistent vendoring":because the outer module isn't actually using vendoring.
This can be avoided by passing the overlay to the second invocation also, in which case it treats
testdata/go1.0
as its own module.The text was updated successfully, but these errors were encountered: