Skip to content

Proposal: Respect the vendor folder is one exits. #34371

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

Closed
ardan-bkennedy opened this issue Sep 18, 2019 · 4 comments
Closed

Proposal: Respect the vendor folder is one exits. #34371

ardan-bkennedy opened this issue Sep 18, 2019 · 4 comments

Comments

@ardan-bkennedy
Copy link

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

$ go version
go version go1.13 darwin/amd64

Does this issue reproduce with the latest release?

Yes

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

go env Output
$ go env
GO111MODULE=""
GOARCH="amd64"
GOBIN=""
GOCACHE="/Users/bill/Library/Caches/go-build"
GOENV="/Users/bill/Library/Application Support/go/env"
GOEXE=""
GOFLAGS=""
GOHOSTARCH="amd64"
GOHOSTOS="darwin"
GONOPROXY=""
GONOSUMDB=""
GOOS="darwin"
GOPATH="/Users/bill/code/go"
GOPRIVATE=""
GOPROXY="https://proxy.golang.org,direct"
GOROOT="/usr/local/go"
GOSUMDB="sum.golang.org"
GOTMPDIR=""
GOTOOLDIR="/usr/local/go/pkg/tool/darwin_amd64"
GCCGO="gccgo"
AR="ar"
CC="clang"
CXX="clang++"
CGO_ENABLED="1"
GOMOD="/Users/bill/code/go/src/github.com/ardanlabs/gotraining/go.mod"
CGO_CFLAGS="-g -O2"
CGO_CPPFLAGS=""
CGO_CXXFLAGS="-g -O2"
CGO_FFLAGS="-g -O2"
CGO_LDFLAGS="-g -O2"
PKG_CONFIG="pkg-config"
GOGCCFLAGS="-fPIC -m64 -pthread -fno-caret-diagnostics -Qunused-arguments -fmessage-length=0 -fdebug-prefix-map=/var/folders/f8/nl6gsnzs1m7530bkx9ct8rzc0000gn/T/go-build841739576=/tmp/go-build -gno-record-gcc-switches -fno-common"

What did you do?

I have a project with a vendor folder that was converted from the dep tool. Now I use go mod tidy/vendor. As of 1.13, if I use the go build|test calls, the vendor folder is ignored and modules is being used.

I can't remove the go.mod/sum files because I need them to support future go mod tidy/vendor calls.

What did you expect to see?

I expected backwards compatibility with the vendor folder and it to be respected. It is irrelvant how that folder is being maintained. Since I used Go's support to maintain it, Go should still respect it as a first priority. Vendoring has been around long before modules.

What did you see instead?

This is causing me all sorts of workflow problems. I now have to use -mod=vendor for the vendor folder to be respected. I have to set this as a default in my editor for calling all the Go tooling commands.

If I decide to move to the terminal and manually run go build|test I need to remember to use that flag. If I use the flag on a project not using modules, I get compiler messages about the project not using modules. So now I have to reverse the setting, which I can't in an editor. Working with different projects using different schemes for dependencies is now very difficult.

Simple solution

If the Go tool respected the vendor folder as a first priority, maintaining years of backwards compatibility, all these issues go away. Any project using vendoring doesn't feel the effect of this new module system.

@gopherbot gopherbot added this to the Proposal milestone Sep 18, 2019
@bcmills
Copy link
Contributor

bcmills commented Sep 18, 2019

Please check for existing issues before filing new ones. This one has been filed many times already and has ongoing work for Go 1.14.

@bcmills
Copy link
Contributor

bcmills commented Sep 18, 2019

Duplicate of #33848

@bcmills bcmills marked this as a duplicate of #33848 Sep 18, 2019
@bcmills bcmills closed this as completed Sep 18, 2019
@bcmills
Copy link
Contributor

bcmills commented Sep 18, 2019

Note that in the meantime, you can use the vendor directory automatically by setting GOFLAGS=-mod=vendor in your environment (or using go env -w GOFLAGS=-mod=vendor), or disable module mode (and drop back to the GOPATH-mode vendoring behavior) by setting GO111MODULE=off explicitly.

@ardan-bkennedy
Copy link
Author

Sorry for the duplicate issue. If the tooling didn't error when the -mod=vendor flag existed without a vendor folder, I would have been ok. Setting GOFLAGS doesn't work because of the compiler errors. Projects also start out without dep management, then it is added in, then vendoring may be the option. Again, setting these global settings don't work.

I just think if a vendor folder is respected, all of these workflow issues go away. The default behavior works. Projects don't need the extra flags.

@golang golang locked and limited conversation to collaborators Sep 17, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

3 participants