Description
What version of Go are you using (go version
)?
$ go version go version devel +4b3f04c63b Thu Jan 10 18:15:48 2019 +0000 linux/amd64
Does this issue reproduce with the latest release?
Yes. Tested on 1.11.4 and tried with 1.12-beta2.
What operating system and processor architecture are you using (go env
)?
go env
Output
$ go env GOARCH="amd64" GOBIN="" GOCACHE="/home/jeff/.cache/go-build" GOEXE="" GOFLAGS="" GOHOSTARCH="amd64" GOHOSTOS="linux" GOOS="linux" GOPATH="/home/jeff/go" GOPROXY="" GORACE="" GOROOT="/home/jeff/src/go" GOTMPDIR="" GOTOOLDIR="/home/jeff/src/go/pkg/tool/linux_amd64" GCCGO="gccgo" CC="gcc" CXX="g++" CGO_ENABLED="1" GOMOD="/home/jeff/hc/vault/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-build737217089=/tmp/go-build -gno-record-gcc-switches"
What did you do?
When trying to convert a large program from govendor to go modules, I'm seeing behavior where many of the dependencies are being overwritten after I set them; a version using a git commit will be overwritten by the latest tag, even if that latest tag is extremely old.
Invoking any go
command causes this overwriting.
This only seems to affect specified revisions that are merge commits (as in, the product of a PR merge). When the merge commit is used the version is v0.0.0-<timestamp>-<revision>
. When I use the non-merge commit, it shows up with v0.9.2-<timestamp>-<revision>
.
What did you expect to see?
Once I set a version, it is left alone.
What did you see instead?
(You can follow along in the gomodtry2
branch in github.com/hashicorp/vault
if you like)
$ grep SermoDigital go.mod
github.com/SermoDigital/jose v0.9.1
$ go get github.com/SermoDigital/jose@803625baeddc
$ grep SermoDigital go.mod
github.com/SermoDigital/jose v0.0.0-20180104203859-803625baeddc
$ go mod why github.com/SermoDigital/jose
go: finding github.com/influxdata/platform/models latest
go: finding github.com/influxdata/platform latest
# github.com/SermoDigital/jose
github.com/hashicorp/vault/audit
github.com/SermoDigital/jose/jws
github.com/SermoDigital/jose
$ grep SermoDigital go.mod
github.com/SermoDigital/jose v0.9.1
$ go get github.com/SermoDigital/jose@a0450ddff675
$ grep SermoDigital go.mod
github.com/SermoDigital/jose v0.9.2-0.20180104202408-a0450ddff675
$ go mod why github.com/SermoDigital/jose
# github.com/SermoDigital/jose
github.com/hashicorp/vault/audit
github.com/SermoDigital/jose/jws
github.com/SermoDigital/jose
$ grep SermoDigital go.mod
github.com/SermoDigital/jose v0.9.2-0.20180104202408-a0450ddff675
$ go get github.com/SermoDigital/jose@803625baeddc
$ grep SermoDigital go.mod
github.com/SermoDigital/jose v0.0.0-20180104203859-803625baeddc
$ go mod why github.com/SermoDigital/jose
go: finding github.com/influxdata/platform/models latest
go: finding github.com/influxdata/platform latest
# github.com/SermoDigital/jose
github.com/hashicorp/vault/audit
github.com/SermoDigital/jose/jws
github.com/SermoDigital/jose
$ grep SermoDigital go.mod
github.com/SermoDigital/jose v0.9.1