Skip to content

cmd/go: Since 1.18.1, go run always uses -buildvcs=false #52338

Closed
@mgabeler-lee-6rs

Description

@mgabeler-lee-6rs

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

$ go version
go version go1.18.1 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="/home/circleci/.cache/go-build"
GOENV="/home/circleci/.config/go/env"
GOEXE=""
GOEXPERIMENT=""
GOFLAGS=""
GOHOSTARCH="amd64"
GOHOSTOS="linux"
GOINSECURE=""
GOMODCACHE="/home/circleci/go/pkg/mod"
GONOPROXY=""
GONOSUMDB=""
GOOS="linux"
GOPATH="/home/circleci/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.18.1"
GCCGO="gccgo"
GOAMD64="v1"
AR="ar"
CC="gcc"
CXX="g++"
CGO_ENABLED="0"
GOMOD="/home/circleci/project/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 -fmessage-length=0 -fdebug-prefix-map=/tmp/go-build2409035375=/tmp/go-build -gno-record-gcc-switches"

What did you do?

Attempting to extract VCS info from debug.ReadBuildInfo() when running under go run.

  1. https://go.dev/play/p/_09ZOz1UlC7
  2. Create a new directory
  3. go mod init example
  4. Save the playground code as main.go
  5. git add . && git commit -m 'example'
  6. go run .

What did you expect to see?

With go 1.18.0, I get:

$ go run . 
-compiler gc
CGO_ENABLED 1
CGO_CFLAGS 
CGO_CPPFLAGS 
CGO_CXXFLAGS 
CGO_LDFLAGS 
GOARCH amd64
GOOS linux
GOAMD64 v1
vcs git
vcs.revision 3905f8828680bce9d913660e098c704687ec309b
vcs.time 2022-04-13T20:07:46Z
vcs.modified false

What did you see instead?

With go 1.18.1:

$ go run . 
-compiler gc
CGO_ENABLED 0
GOARCH amd64
GOOS linux
GOAMD64 v1

Even worse, -buildvcs=auto is not recognized:

$ go run -buildvcs=auto .
invalid boolean value "auto" for -buildvcs: parse error
usage: go run [build flags] [-exec xprog] package [arguments...]
Run 'go help run' for details.

Even even worse, -buildvcs=true is ignored:

$ go run -buildvcs=true .
-compiler gc
CGO_ENABLED 0
GOARCH amd64
GOOS linux
GOAMD64 v1

Metadata

Metadata

Assignees

No one assigned

    Labels

    FrozenDueToAgeGoCommandcmd/goNeedsInvestigationSomeone must examine and confirm this is a valid issue and not a duplicate of an existing one.

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions