How to copy deps from GOPATH using go mod vendor?

383 Views Asked by At

How do I make go mod vendor copy dependencies from GOPATH instead of downloading them over the network?

1

There are 1 best solutions below

0
On

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.