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: make -mod=vendor a noop in GOPATH mode #29665

Closed
kardianos opened this issue Jan 10, 2019 · 2 comments

Comments

Projects
None yet
4 participants
@kardianos
Copy link
Contributor

commented Jan 10, 2019

@bcmills

Reproduces as of 2018-01-10 at HEAD.

In my build scripts I've added -mod=vendor for a project. This works great when outside of GOPATH. On a different computer that still has the source inside GOPATH, I get an error:
build flag -mod=vendor only valid when using modules

This error seems like a mistake. I just want to tell go to use the vendor folder. If in GOPATH mode, it will already do that. But go mod mode currently requires a flag. Is there a situation where someone would pass in -mod=vendor while in GOPATH mode and it would do something unexpected?

This is a sub-issue of #27227, but perhaps it would be small and simple enough to make it in 1.12.

@cespare

This comment has been minimized.

Copy link
Contributor

commented Jan 10, 2019

I ran into this as part of looking into #27227 (comment). One thing I noticed is that if you specify this not via the flag but instead using GOFLAGS='-mod=vendor', then it works fine in GOPATH mode.

@julieqiu julieqiu added this to the Go1.12 milestone Jan 10, 2019

@bcmills

This comment has been minimized.

Copy link
Member

commented Jan 11, 2019

Given that you can use GOFLAGS as a workaround — and given how far into the 1.12 freeze we are — I'd rather not add the -mod flag to GOPATH mode.

Sorry, but let's wait and address #27227 holistically.

@bcmills bcmills closed this Jan 11, 2019

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.