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
Closed
Labels
FrozenDueToAge Proposal Proposal-FinalCommentPeriod WaitingForInfo Issue is not actionable because of missing required information, which needs to be provided.
Milestone

Comments

@mcandre
Copy link

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
@mvdan
Copy link
Member

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

@mvdan mvdan added the WaitingForInfo Issue is not actionable because of missing required information, which needs to be provided. label Nov 11, 2019
@bcmills
Copy link
Contributor

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
Copy link
Contributor

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 (old) Nov 27, 2019
@rsc
Copy link
Contributor

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 (old) Dec 4, 2019
@rsc
Copy link
Contributor

rsc commented Dec 4, 2019

No change in consensus so declining.

@rsc rsc closed this as completed Dec 4, 2019
@rsc rsc moved this from Likely Decline to Declined in Proposals (old) Dec 11, 2019
@golang golang locked and limited conversation to collaborators Dec 3, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
FrozenDueToAge Proposal Proposal-FinalCommentPeriod WaitingForInfo Issue is not actionable because of missing required information, which needs to be provided.
Projects
No open projects
Development

No branches or pull requests

5 participants