cd $my_go_module
vgo get
All the dependencies listed in the go.mod file ready for the next build.
> vgo get
vgo get: need arguments or -u
GOARCH="amd64"
GOBIN=""
GOCACHE="/Users/pierre/Library/Caches/go-build"
GOEXE=""
GOHOSTARCH="amd64"
GOHOSTOS="darwin"
GOOS="darwin"
GOPATH="/Users/pierre/code"
GORACE=""
GOROOT="/usr/local/Cellar/go/1.10/libexec"
GOTMPDIR=""
GOTOOLDIR="/usr/local/Cellar/go/1.10/libexec/pkg/tool/darwin_amd64"
GCCGO="gccgo"
CC="clang"
CXX="clang++"
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 -fno-caret-diagnostics -Qunused-arguments -fmessage-length=0 -fdebug-prefix-map=/var/folders/1_/m_98m3w13zddr8ph_1d6lhb40000gp/T/go-build605510730=/tmp/go-build -gno-record-gcc-switches -fno-common"
VGOMODROOT=""
vgo getMy workflow contemplates frequent Docker builds. In my Dockerfile, I want to be able to fetch the project dependencies in a step _before_ copying (and building) my actual code from the host, so that Docker can cache the dependency-fetching layer and reuse it if I change the code of my module.
It would be great to have a command that just resolves imports/requires and downloads the dependencies. This is very useful for CI systems that often download package first, cache them and then move on to running tests. With current design, a CI system will not be able to cache dependencies until the tests pass.
So it would be great for vgo get or a new command to just download/cache all dependencies and exit.
Yes, we need to figure out what this means exactly.
This seems to be similar what go get ./... does, isn't it?
At least vgo get ./... was my first try to prefetch dependencies (I did it before vgo using the above construct), but it fails with the following:
FindRepo: Get https://./...?go-get=1: dial tcp: lookup .: No address associated with hostname
vgo get ./...: Get https://./...?go-get=1: dial tcp: lookup .: No address associated with hostname
Change https://golang.org/cl/122396 mentions this issue: cmd/go/internal/get: complete implementation
Most helpful comment
This seems to be similar what
go get ./...does, isn't it?At least
vgo get ./...was my first try to prefetch dependencies (I did it beforevgousing the above construct), but it fails with the following: