Skip to content

cmd/go: git revision information stamping on CentOS 7 fails with Go 1.18rc1: error obtaining VCS status: exit status 128 #51253

@polarina

Description

@polarina

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

$ go version
go version go1.18rc1 linux/amd64
$ cat /etc/os-release 
NAME="CentOS Linux"
VERSION="7 (Core)"
ID="centos"
ID_LIKE="rhel fedora"
VERSION_ID="7"
PRETTY_NAME="CentOS Linux 7 (Core)"
ANSI_COLOR="0;31"
CPE_NAME="cpe:/o:centos:centos:7"
HOME_URL="https://www.centos.org/"
BUG_REPORT_URL="https://bugs.centos.org/"

CENTOS_MANTISBT_PROJECT="CentOS-7"
CENTOS_MANTISBT_PROJECT_VERSION="7"
REDHAT_SUPPORT_PRODUCT="centos"
REDHAT_SUPPORT_PRODUCT_VERSION="7"

Does this issue reproduce with the latest release?

This issue affects Go 1.18 only. Go 1.17 is unaffected.

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

go env Output
$ go env
GO111MODULE=""
GOARCH="amd64"
GOBIN=""
GOCACHE="/home/ava-gabriel/.cache/go-build"
GOENV="/home/ava-gabriel/.config/go/env"
GOEXE=""
GOEXPERIMENT=""
GOFLAGS=""
GOHOSTARCH="amd64"
GOHOSTOS="linux"
GOINSECURE=""
GOMODCACHE="/home/ava-gabriel/go/pkg/mod"
GONOPROXY=""
GONOSUMDB=""
GOOS="linux"
GOPATH="/home/ava-gabriel/go"
GOPRIVATE=""
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.18rc1"
GCCGO="gccgo"
GOAMD64="v1"
AR="ar"
CC="gcc"
CXX="g++"
CGO_ENABLED="1"
GOMOD="/dev/null"
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-build3218995411=/tmp/go-build -gno-record-gcc-switches"

What did you do?

[ava-gabriel@proclidev01 ~]$ mkdir hello
[ava-gabriel@proclidev01 ~]$ cd hello
[ava-gabriel@proclidev01 hello]$ git init
Initialized empty Git repository in /home/ava-gabriel/hello/.git/
[ava-gabriel@proclidev01 hello]$ echo 'package main' > main.go
[ava-gabriel@proclidev01 hello]$ go mod init example.com/hello
go: creating new go.mod: module example.com/hello
go: to add module requirements and sums:
	go mod tidy
[ava-gabriel@proclidev01 hello]$ git add .
[ava-gabriel@proclidev01 hello]$ git commit -m 'initial commit'
[master (root-commit) 2d02bea] initial commit
 2 files changed, 4 insertions(+)
 create mode 100644 go.mod
 create mode 100644 main.go
[ava-gabriel@proclidev01 hello]$ go build ./...
error obtaining VCS status: exit status 128
	Use -buildvcs=false to disable VCS stamping.

What did you expect to see?

I expected go build to complain about missing main, but that's only due to the triviality of the reproduction steps.

[ava-gabriel@proclidev01 hello]$ go build ./...
# example.com/hello
runtime.main_main·f: function main is undeclared in the main package

What did you see instead?

[ava-gabriel@proclidev01 hello]$ go build ./...
error obtaining VCS status: exit status 128
	Use -buildvcs=false to disable VCS stamping.

Probable cause

The command line argument --no-show-signature is not supported by Git on CentOS 7:

[ava-gabriel@proclidev01 hello]$ go build -x ./...
WORK=/tmp/go-build592561444
cd /home/ava-gabriel/hello
git status --porcelain
cd /home/ava-gabriel/hello
git show -s --no-show-signature --format=%H:%ct
error obtaining VCS status: exit status 128
	Use -buildvcs=false to disable VCS stamping.
[ava-gabriel@proclidev01 hello]$ git show -s --no-show-signature --format=%H:%ct
fatal: unrecognized argument: --no-show-signature
[ava-gabriel@proclidev01 hello]$ git --version
git version 1.8.3.1

Metadata

Metadata

Assignees

No one assigned

    Labels

    FrozenDueToAgeGoCommandcmd/goNeedsFixThe path to resolution is known, but the work has not been done.

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions