Go: x/vgo: define and implement "vgo get" (with no args)

Created on 24 Feb 2018  ·  4Comments  ·  Source: golang/go

What did you do?

cd $my_go_module
vgo get

What did you expect to see?

All the dependencies listed in the go.mod file ready for the next build.

What did you see instead?

> vgo get
vgo get: need arguments or -u

System details

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=""

why do I need vgo get

My 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.

FrozenDueToAge NeedsDecision

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 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

All 4 comments

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

Was this page helpful?
0 / 5 - 0 ratings