Skip to content

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

@ardan-bkennedy

Description

@ardan-bkennedy

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.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions