How do I make go mod vendor
copy dependencies from GOPATH
instead of downloading them over the network?
Asked
Active
Viewed 335 times
0
-
Shouldn't it always look for dependencies in GOPATH first and only if it doesn't find them there, look for them over the network? – luben Apr 24 '19 at 11:54
1 Answers
0
There is no way to do this in general: modules are intentionally a separate workspace from GOPATH
, and go mod vendor
copies dependencies from the module workspace.
That said, if you can figure out what versions the various repos in your GOPATH
are sync'd to, you can run go get -d <repo>@<version>
within your module for each such repo to synchronize your module workspace to that version.

bcmills
- 4,391
- 24
- 34