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: replace doesn't effect in require packages #36205

Closed
zhanw15 opened this issue Dec 18, 2019 · 3 comments
Closed

cmd/go: go mod: replace doesn't effect in require packages #36205

zhanw15 opened this issue Dec 18, 2019 · 3 comments
Labels
FrozenDueToAge WaitingForInfo Issue is not actionable because of missing required information, which needs to be provided.

Comments

@zhanw15
Copy link

zhanw15 commented Dec 18, 2019

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

go version go1.13.5 linux/amd64

Does this issue reproduce with the latest release?

YES

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

go env Output
GO111MODULE=""
GOARCH="amd64"
GOBIN=""
GOCACHE="/root/.cache/go-build"
GOENV="/root/.config/go/env"
GOEXE=""
GOFLAGS=""
GOHOSTARCH="amd64"
GOHOSTOS="linux"
GONOPROXY=""
GONOSUMDB=""
GOOS="linux"
GOPATH="/root/go"
GOPRIVATE=""
GOPROXY="https://goproxy.cn"
GOROOT="/root/go-go1.13.5"
GOSUMDB="sum.golang.org"
GOTMPDIR=""
GOTOOLDIR="/root/go-go1.13.5/pkg/tool/linux_amd64"
GCCGO="gccgo"
AR="ar"
CC="gcc"
CXX="g++"
CGO_ENABLED="1"
GOMOD="/root/gomod/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 -fmessage-length=0 -fdebug-prefix-map=/tmp/go-build037664404=/tmp/go-build -gno-record-gcc-switches"

What did you do?

In project A's go.mod, I require project B, when I use go mod download in project A, I will get error because of project B's go.mod's replace not effect.

A's go.mod

module github.com/zhanw15/xxxx
  
go 1.13

require (
        k8s.io/kubernetes v1.16.2
)

B's go.mod

module k8s.io/kubernetes

go 1.13

require (
	k8s.io/api v0.0.0
)

replace (
	k8s.io/api => ./staging/src/k8s.io/api
)

error is:

go: k8s.io/kubernetes@v1.16.2 requires
	k8s.io/api@v0.0.0: reading https://goproxy.cn/k8s.io/api/@v/v0.0.0.mod: 404 Not Found

What did you expect to see?

replace should be effort in require packages.

@zhanw15
Copy link
Author

zhanw15 commented Dec 18, 2019

/bug

@dmitshur
Copy link
Contributor

Thanks for reporting.

I believe this is working as intended. This is documented at https://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.

@dmitshur dmitshur added the WaitingForInfo Issue is not actionable because of missing required information, which needs to be provided. label Dec 18, 2019
@dmitshur dmitshur changed the title go mod: repalce does't effect in require packages cmd/go: go mod: replace doesn't effect in require packages Dec 18, 2019
@gopherbot
Copy link

Timed out in state WaitingForInfo. Closing.

(I am just a bot, though. Please speak up if this is a mistake or you have the requested information.)

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
FrozenDueToAge WaitingForInfo Issue is not actionable because of missing required information, which needs to be provided.
Projects
None yet
Development

No branches or pull requests

3 participants