How to download all dependencies with vgo and a given go.mod?
How to download all dependencies with vgo and a given go.mod? I'm working on a go project, using vgo, with a Dockerfile, and I'd like docker to cache the dependencies of the project such that it has two properties: go.mod go.mod Right now, I do: ... RUN go get -u golang.org/x/vgo COPY . /go/src/whatever RUN vgo install ... But if you change a go file, the dockerfile will have to be rebuilt from the COPY layer onwards. COPY What I'd like, in short, is to do: ... RUN go get -u golang.org/x/vgo COPY go.mod /go/src/whatever RUN vgo install_dependencies COPY . /go/src/whatever RUN vgo install ... That way, if I change go.mod , all the dependencies will be downloaded and rebuilt, but otherwise, we can proceed right to building the binary. go.mod I can see a couple of ways to get behavior like this, but all of them have drawbacks: $GOPATH/src/mod vgo mod -vendor vgo mod -vendor go.mod vgo mod -vendor Can you think of a way for me to get behavior like my imaginary vgo install_depe...