Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

proposal: cmd/go: have `go get`... look in vendored caches for dependencies #35510

Closed
mcandre opened this issue Nov 11, 2019 · 5 comments

Comments

@mcandre
Copy link

@mcandre mcandre commented Nov 11, 2019

I already have gopkg.in/yaml.v2 in my vendor/ directory, managed with go mod vendor. However, when I run go get github.com/tsg/gotpl, this cache is ignored and the command fails due to how my particular network's proxies work.

Can we please have go get... check for dependencies in vendor/, for more reproducible development environments and less network strain?

@gopherbot gopherbot added this to the Proposal milestone Nov 11, 2019
@gopherbot gopherbot added the Proposal label Nov 11, 2019
@mvdan

This comment has been minimized.

Copy link
Member

@mvdan mvdan commented Nov 11, 2019

vendor/ contains packages, but go get in module mode downloads modules. Those are entirely different things. How exactly would this work?

/cc @bcmills

@bcmills

This comment has been minimized.

Copy link
Member

@bcmills bcmills commented Nov 11, 2019

Per https://golang.org/cmd/go/#hdr-Add_dependencies_to_current_module_and_install_them:

By default, get looks up the latest tagged release version, such as v0.4.5 or v1.2.3. If there are no tagged release versions, get looks up the latest tagged pre-release version, such as v0.0.1-pre1. If there are no tagged versions at all, get looks up the latest known commit.

The go command has know no way to know whether the contents in your vendor directory are the latest version.

@rsc

This comment has been minimized.

Copy link
Contributor

@rsc rsc commented Nov 27, 2019

As @mvdan and @bcmills pointed out, this is infeasible. The vendor directory by design does not contain full modules, only necessary packages for a build.

@mcandre, as of Go 1.14 the go command will load packages from vendor automatically when it exists, so that will help "more reproducible development environments and less network strain" during builds. But go get is an operation managing dependency versions. It necessarily has to talk to the network to find the latest version of the thing you asked to go get. (go get X with no version means go get X@latest.) If you are using go get in a CI environment as a synonym for go build or go install, use one of those instead.

@rsc rsc changed the title Proposal: Have `go get`... look in vendored caches for dependencies proposal: cmd/go: have `go get`... look in vendored caches for dependencies Nov 27, 2019
@rsc rsc added this to Incoming in Proposals Nov 27, 2019
@rsc

This comment has been minimized.

Copy link
Contributor

@rsc rsc commented Nov 27, 2019

Given that this is not possible - the vendor directory does not contain full modules, and people would object if it did - this seems like a likely decline.

Leaving open for a week for final comments.

@rsc rsc moved this from Incoming to Likely Decline in Proposals Dec 4, 2019
@rsc

This comment has been minimized.

Copy link
Contributor

@rsc rsc commented Dec 4, 2019

No change in consensus so declining.

@rsc rsc closed this Dec 4, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Proposals
Likely Decline
5 participants
You can’t perform that action at this time.