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

cmd/go: allow -getmode=vendor in environment variable #26585

surajbarkale opened this issue Jul 25, 2018 · 3 comments

cmd/go: allow -getmode=vendor in environment variable #26585

surajbarkale opened this issue Jul 25, 2018 · 3 comments


Copy link

@surajbarkale surajbarkale commented Jul 25, 2018

What version of Go are you using (go version)?


Does this issue reproduce with the latest release?


What operating system and processor architecture are you using (go env)?


Feature request

Can we please have an environment variable which would enable the relevant vgo operations to always use -getmode=vendor (or any other value)? Something like GOMODULE_GETMODE?

The reason is that while $enterprise borderline caching proxies are a good thing—in theory, in practice we here at $dayjob are not yet ready to deploy something like this and are already using vendoring as an almost perfect solution to combat both the different variants of the "left-pad problem" (including the "github is down" one) and the versioning problem—everyone get the set of vendored packages of blessed versions, and the vendored packages get upgraded by explicit manual intervention after much discussion and experimentation and tests.
We'd like this to be working as easy as it is now in perpetuity, if possible.

This issue is generated from a unaddressed comment made on a closed issue.

@oiooj oiooj added the modules label Jul 25, 2018
Copy link

@rsc rsc commented Jul 25, 2018

To date we have never provided an environment variable that duplicates a command-line flag in the go command. I'm reluctant to start now.

@rsc rsc changed the title Provide environment variable to set -getmode=vendor for all go mod operations cmd/go: allow -getmode=vendor in environment variable Jul 25, 2018
Copy link

@surajbarkale surajbarkale commented Jul 25, 2018

Even though I work in a large organisation, my team is the only one that uses go. We are unable to set up extra infrastructure (metadata servers, proxies) because of manpower required to maintain it is not available.

The vendor directory workflow has been instrumental in supporting go internally. We have following workflow:

  1. New dependencies (or updates to existing once) are brought in by individual devs.
  2. The resulting vendor folder is committed to git along with the lock files.
  3. When building the code, no internet access is needed for individual developers or CI machines.

I am expecting modules to support this workflow without developers having to jump through hoops every time.

Setting environment variable which can be overridden from command line is one option. Other option is to specify the default getmode in go.mod and override it from command line option.

In day-to-day operations, I want devs to be able to just execute go build or go test and not have to worry about dealing with missing dependencies.

Copy link

@gopherbot gopherbot commented Jul 29, 2018

Change mentions this issue: cmd/go: add $GOFLAGS environment variable

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
4 participants