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: 'go mod vendor' replacement fails if indirect #33566

Closed
Teelevision opened this issue Aug 9, 2019 · 1 comment
Closed

cmd/go: 'go mod vendor' replacement fails if indirect #33566

Teelevision opened this issue Aug 9, 2019 · 1 comment

Comments

@Teelevision
Copy link

@Teelevision Teelevision commented Aug 9, 2019

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

$ go version
go version go1.12.7 darwin/amd64

Does this issue reproduce with the latest release?

Untested.

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

go env Output
$ go env
GOARCH="amd64"
GOBIN=""
GOCACHE="/Users/marius/Library/Caches/go-build"
GOEXE=""
GOFLAGS=""
GOHOSTARCH="amd64"
GOHOSTOS="darwin"
GOOS="darwin"
GOPATH="/Users/marius/go"
GOPROXY=""
GORACE=""
GOROOT="/usr/local/Cellar/go/1.12.7/libexec"
GOTMPDIR=""
GOTOOLDIR="/usr/local/Cellar/go/1.12.7/libexec/pkg/tool/darwin_amd64"
GCCGO="gccgo"
CC="clang"
CXX="clang++"
CGO_ENABLED="1"
GOMOD="/Users/marius/PACE/bricks/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/bn/qgsj5pj57hz95p6bknh10hw40000gn/T/go-build673679875=/tmp/go-build -gno-record-gcc-switches -fno-common"

What did you do?

I replaced a dependency with a modified version in a module A: pace/bricks@be63835

When I do go mod vendor the modified version correctly appears in the vendor directory. If I however, in another module B, depend on that module A, go mod vendor places the original and not the modified version of the dependency in the vendor directory.

So it seems that replacements only work on the module that introduces them, not on other modules.

What did you expect to see?

Module A and module B should have the same version of the dependency in the vendor directory.

What did you see instead?

Module A has the modified dependency, module B the original.

@bcmills

This comment has been minimized.

Copy link
Member

@bcmills bcmills commented Aug 9, 2019

This is working as designed. Per https://tip.golang.org/cmd/go/#hdr-The_go_mod_file:

Exclude and replace apply only in the main module's go.mod and are ignored in dependencies. See https://research.swtch.com/vgo-mvs for details.

@bcmills bcmills closed this Aug 9, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
2 participants
You can’t perform that action at this time.