Closed
Description
What version of Go are you using (go version
)?
$ go version go version go1.18.4 linux/amd64
Does this issue reproduce with the latest release?
Yes. I was able to reproduce from Docker image golang:1.18.4
.
What operating system and processor architecture are you using (go env
)?
go env
Output
$ go env GO111MODULE="" GOARCH="amd64" GOBIN="" GOCACHE="/root/.cache/go-build" GOENV="/root/.config/go/env" GOEXE="" GOEXPERIMENT="" GOFLAGS="" GOHOSTARCH="amd64" GOHOSTOS="linux" GOINSECURE="" GOMODCACHE="/go/pkg/mod" GONOPROXY="github.com/central182" GONOSUMDB="github.com/central182" GOOS="linux" GOPATH="/go" GOPRIVATE="github.com/central182" GOPROXY="https://proxy.golang.org,direct" GOROOT="/usr/local/go" GOSUMDB="sum.golang.org" GOTMPDIR="" GOTOOLDIR="/usr/local/go/pkg/tool/linux_amd64" GOVCS="" GOVERSION="go1.18.4" GCCGO="gccgo" GOAMD64="v1" AR="ar" CC="gcc" CXX="g++" CGO_ENABLED="1" GOMOD="/root/example/go.mod" GOWORK="" 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-build856782336=/tmp/go-build -gno-record-gcc-switches"
What did you do?
On my host machine
- Create a private Go module. (Say it's hosted on https://github.com/central182/foobar and the latest commit is
ef2f664
, with tagv1.0.9
pointing to some earlier commit.) - Launch a Docker container that is able to access my private repositories on GitHub.
$ docker run -it -v /home/me/shared_ssh:/root/.ssh golang:1.18.4
Inside Docker
- Do the necessary configuration for downloading private Go modules via SSH.
$ export GOPRIVATE=github.com/central182
$ git config --global url."ssh://[email protected]".insteadOf "https://github.com"
- Create a temporary Go module.
$ cd ~ && mkdir example && cd example && go mod init example
go: creating new go.mod: module example
- Get the
foobar
module with its latest commit hashef2f664
.
$ go get github.com/central182/foobar@ef2f664
go: downloading github.com/central182/foobar v1.0.10-0.20220226164108-ef2f6641951f
go get: added github.com/central182/foobar v1.0.10-0.20220226164108-ef2f6641951f
On my host machine
- Tag
ef2f664
withv1.0.10
and push it to GitHub.
$ git tag v1.0.10
$ git push --tags
Total 0 (delta 0), reused 0 (delta 0), pack-reused 0
To github.com:central182/foobar.git
* [new tag] v1.0.10 -> v1.0.10
$ git log --oneline
ef2f664 (HEAD -> main, tag: v1.0.10, origin/main) Empty commit
Inside Docker
- Try to get the
foobar
module with the tagv1.0.10
, and watch it fail.
$ go get github.com/central182/[email protected]
go get: github.com/central182/[email protected]: invalid version: resolves to version v1.0.11-0.20220226164108-ef2f6641951f (v1.0.10 is not a tag)
- However, if I repeat step 7 again, the download will succeed.
$ go get github.com/central182/[email protected]
go: downloading github.com/central182/foobar v1.0.10
go get: upgraded github.com/central182/foobar v1.0.10-0.20220226164108-ef2f6641951f => v1.0.10
What did you expect to see?
No failure at step 7.
What did you see instead?
The tag did exist while go
said otherwise.