Closed
Description
What version of Go are you using (go version
)?
$ go version go version devel +1cd724acb6 Tue Feb 18 20:21:35 2020 +0000 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
$ go env GO111MODULE="" GOARCH="amd64" GOBIN="/tmp/tmp.iN3J3OviqO/bin" GOCACHE="/home/myitcv/.cache/go-build" GOENV="/home/myitcv/.config/go/env" GOEXE="" GOFLAGS="" GOHOSTARCH="amd64" GOHOSTOS="linux" GOINSECURE="" GONOPROXY="" GONOSUMDB="" GOOS="linux" GOPATH="/tmp/tmp.YATmfepfQp" GOPRIVATE="" GOPROXY="https://proxy.golang.org,direct" GOROOT="/home/myitcv/gos" GOSUMDB="sum.golang.org" GOTMPDIR="" GOTOOLDIR="/home/myitcv/gos/pkg/tool/linux_amd64" GCCGO="gccgo" AR="ar" CC="gcc" CXX="g++" CGO_ENABLED="1" GOMOD="/tmp/tmp.iN3J3OviqO/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-build497027281=/tmp/go-build -gno-record-gcc-switches"
What did you do?
export GOPATH=$(mktemp -d)
cd $(mktemp -d)
export GOBIN=$PWD/bin
go mod init example.com/hello
go get -d github.com/myitcvscratch/[email protected]
go install github.com/myitcvscratch/main1
./bin/main1
gives:
Hello
and:
go version -m ./bin/main1
gives:
./bin/main1: devel +1cd724acb6 Tue Feb 18 20:21:35 2020 +0000
path github.com/myitcvscratch/main1
mod github.com/myitcvscratch/main1 v0.0.0-20200223195030-0e559444dd31 h1:ksuMuyNXJTVEqPoCW7OFo0yey/ijEj3Rxt56WwUPbD4=
Then:
go mod edit -replace=github.com/myitcvscratch/main1=github.com/myitcvscratch/[email protected]
go install github.com/myitcvscratch/main1
./bin/main1
gives:
Goodbye
But:
go version -m ./bin/main1
gives:
./bin/main1: devel +1cd724acb6 Tue Feb 18 20:21:35 2020 +0000
path github.com/myitcvscratch/main1
mod github.com/myitcvscratch/main1 v0.0.0-20200223195030-0e559444dd31 h1:ksuMuyNXJTVEqPoCW7OFo0yey/ijEj3Rxt56WwUPbD4=
i.e. the newly built binary does not include any information about the fact that github.com/myitcvscratch/main1
has been replaced, nor is any information about github.com/myitcvscratch/main2
included in the runtime/debug.BuildInfo
What did you expect to see?
Some reflection of the fact that github.com/myitcvscratch/main1
has been replaced with github.com/myitcvscratch/main2
in the runtime/debug.BuildInfo
What did you see instead?
As above