Closed rkedward closed 5 years ago
@gopherbot, please add label modules
@rkedward I'm not sure that go mod download
is the what you are looking for here. go mod download
is for more narrow use cases such as pre-populating the module download cache, such as
in base docker images:
https://tip.golang.org/cmd/go/#hdr-Download_modules_to_local_cache
It sounds like part of what you are trying to do is track precise versions of tools as a dependency of your module? If so, you might want to give this FAQ on the modules wiki a quick read: https://github.com/golang/go/wiki/Modules#how-can-i-track-tool-dependencies-for-a-module
and there is a related runnable example of tracking tools as dependencies here (from @myitcv): https://github.com/go-modules-by-example/index/blob/master/010_tools/README.md
And sorry if that is not a perfect answer. You might want to give those a quick read, and then follow up back here with additional questions, or more comments on your use case.
@rkedward - what you want to do here is use go mod vendor
(see https://github.com/go-modules-by-example/index/blob/master/008_vendor_example/README.md for an example) and then move the vendor
to be your $GOPATH/src
directory. I do something similar in my CI for testing with Go 1.10 (ignore the GopherJS hack)
I'll close this on the basis that answers your question; but please shout it not and we can re-open.
Please answer these questions before submitting your issue. Thanks!
What version of Go are you using (
go version
)?1.11.1
Does this issue reproduce with the latest release?
yes
What operating system and processor architecture are you using (
go env
)?What did you do?
What did you expect to see?
The
protoc-gen-go
file$GOPATH/bin directory
after runninggo mod download
What did you see instead?
An empty directory
Rational
I would like to be able to recreate the $GOPATH exactly (bin, pkgs) from go.mod and go.sum. Since go.mod and go.sum are checked into the repository, another could clone the repo and recreate my development environment. This has many advantages for debugging/recreating issues to sharing project development environments between members.