-
Notifications
You must be signed in to change notification settings - Fork 18.5k
Description
What version of Go are you using (go version)?
$ go version go version go1.17.8 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="" GOCACHE="/root/.cache/go-build" GOENV="/root/.config/go/env" GOEXE="" GOEXPERIMENT="" GOFLAGS="" GOHOSTARCH="amd64" GOHOSTOS="linux" GOINSECURE="" GOMODCACHE="/var/tmp/gomodcache" GONOPROXY="*.dev.mycompany.com" GONOSUMDB="*.dev.mycompany.com" GOOS="linux" GOPATH="/go" GOPRIVATE="*.dev.mycompany.com" GOPROXY="https://goproxy.dev.mycompany.com,direct" GOROOT="/usr/local/go" GOSUMDB="sum.golang.org" GOTMPDIR="" GOTOOLDIR="/usr/local/go/pkg/tool/linux_amd64" GOVCS="" GOVERSION="go1.17.8" GCCGO="gccgo" AR="ar" CC="gcc" CXX="g++" CGO_ENABLED="1" GOMOD="/dev/null" 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-build2616314172=/tmp/go-build -gno-record-gcc-switches"
What did you do?
Attempted to fetch/download a module from git via go mod download on a rhel7 (git version 1) system:
go mod download github.dev.mycompany.com/myteam/mymodule@v1.0.1
go mod download: github.dev.mycompany.com/myteam/mymodule@v1.0.1: invalid version: resolves to version v0.0.0-20220103224853-41201e2e180e (v1.0.1 is not a tag)
The OS here is rhel7, which ships with git version one:
$ cat /etc/os-release
NAME="Red Hat Enterprise Linux Server"
VERSION="7.9 (Maipo)"
...
$ git --version
git version 1.8.3.1
When fetching this module on a system with git version 2, go mod download successfully fetches the module (more details below)
What did you expect to see?
go mod download able to successfully use git version 1 to fetch the module.
What did you see instead?
$ go mod download -x github.dev.mycompany.com/myteam/mymodule@v1.0.1
...
cd /var/tmp/gomodcache/cache/vcs/0be68f0b3f6ae46d99c4c556601c77b6f43aebfc8c565c460e79ccf3b9c08b5d; git -c log.showsignature=false log -n1 '--format=format:%H %ct %D' refs/tags/v1.0.1 --
...
Invoking the logged git command directly:
$ cd /var/tmp/gomodcache/cache/vcs/0be68f0b3f6ae46d99c4c556601c77b6f43aebfc8c565c460e79ccf3b9c08b5d; git -c log.showsignature=false log -n1 '--format=format:%H %ct %D' refs/tags/v1.0.1 --
41201e2e180ea3942a7dfd9fa8a7791de3bdf62c 1641250133 %D
It seems this version of git doesn't support the %D format specifier. I will post the full log in a following comment on this issue.
On a system with git version 2:
$ go version
go version go1.17.8 linux/amd64
$ git version
git version 2.25.1
$ go mod download -x github.dev.mycompany.com/myteam/mymodule@v1.0.1
# success
$ cd /var/tmp/gomodcache/cache/vcs/0be68f0b3f6ae46d99c4c556601c77b6f43aebfc8c565c460e79ccf3b9c08b5d; git -c log.showsignature=false log -n1 '--format=format:%H %ct %D' refs/tags/v1.0.1 --
41201e2e180ea3942a7dfd9fa8a7791de3bdf62c 1641250133 grafted, tag: v1.0.1
(Note: I've edited module, github instance and domain names, since these are company private names)
(Note 2: The environment has a git credential helper installed, but I don't think given the successful git access this is relevant)