-
Notifications
You must be signed in to change notification settings - Fork 17.8k
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/vgo: vendor writes misleading vgo.list file #25624
Comments
I am experience a similar thing when using Even stranger if I delete the |
Change https://golang.org/cl/116759 mentions this issue: |
Probably the vgo.list file should be refined to make clear that certain packages from certain modules are copied. For the specific case of iand/vgo-vendor, there's no path from the packages in that repo to anything that imports golang.org/x/tools, so x/tools is (correctly) not copied. It should also not appear in vgo.list. @Piszmog, please file a separate issue about the problem you are seeing, with a bit more detail. I sent a CL 116759 that might help or might not - I don't fully understand what you were reporting. |
It was my expectation that adding Enabling this behaviour would address many use cases where tools supporting development or build are to be versioned along with direct dependencies. Examples include tools referenced by |
A directory x/vendor containing code is just a package called vendor. A directory x/vendor/y is vendored code. When a package pattern scans the current module's file tree it should include a package called vendor but should not include the directories containing vendored code. Maybe related to a comment on golang/go#25624. Change-Id: I083a98a9c70c2121cff7a2f394ff985a54bed37a Reviewed-on: https://go-review.googlesource.com/116759 Run-TryBot: Russ Cox <rsc@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Bryan C. Mills <bcmills@google.com>
@iand that's not what vendor is defined to do. Vendor only copies the specific packages needed by the module, not everything recursively reachable from go.mod (a far larger set). To force vendoring of some set of additional packages, I would suggest putting a file tools.go into the root of the module that says:
You wouldn't put _ "golang.org/x/tools" though, since that's not a command. You want to specify exactly the pieces that you need to be able to build/run. It's important that we have some indication that these are not just unused go.mod entries, since we also want to be able to diagnose unused go.mod entries. :-) |
Change https://golang.org/cl/117258 mentions this issue: |
Please answer these questions before submitting your issue. Thanks!
What version of Go are you using (
go version
)?go 1.10
Does this issue reproduce with the latest release?
yes
What operating system and processor architecture are you using (
go env
)?GOARCH="amd64"
GOBIN=""
GOCACHE="/home/iand/.cache/go-build"
GOEXE=""
GOHOSTARCH="amd64"
GOHOSTOS="linux"
GOOS="linux"
GOPATH="/home/iand"
GORACE=""
GOROOT="/opt/go"
GOTMPDIR=""
GOTOOLDIR="/opt/go/pkg/tool/linux_amd64"
GCCGO="gccgo"
CC="gcc"
CXX="g++"
CGO_ENABLED="1"
CGO_CFLAGS="-g -O2"
CGO_CPPFLAGS=""
CGO_CXXFLAGS="-g -O2"
CGO_FFLAGS="-g -O2"
CGO_LDFLAGS="-g -O2"
PKG_CONFIG="pkg-config"
GOGCCFLAGS="-fPIC -m64 -pthread -fmessage-length=0 -fdebug-prefix-map=/tmp/go-build364187917=/tmp/go-build -gno-record-gcc-switches"
What did you do?
Added a dependency on a package not referred to in an import statement. In this sample it's a tool required for go generate but in the codebase where I first encountered this issue it is several tools used as part of the continuous build process that we have previously vendored in the past using govendor and dep.
Example that reproduces it.
require golang.org/x/tools v0.0.0-20180525024113-a5b4c53f6e8b
togo.mod
What did you expect to see?
The source for golang.org/x/tools to be copied into vendor directory
What did you see instead?
vendor/vgo.list updated to
but golang.org/x/tools is not copied to the vendor directory.
I note from a quick look at the vgo source that the vendor command uses the import list to build the copy list but uses a different list when writing vgo.list
The text was updated successfully, but these errors were encountered: