Go version
go version go1.22.4 darwin/arm64
Output of go env
in your module/workspace:
GO111MODULE=''
GOARCH='arm64'
GOBIN=''
GOCACHE='/Users/paulseebach/Library/Caches/go-build'
GOENV='/Users/paulseebach/Library/Application Support/go/env'
GOEXE=''
GOEXPERIMENT=''
GOFLAGS=''
GOHOSTARCH='arm64'
GOHOSTOS='darwin'
GOINSECURE=''
GOMODCACHE='/Users/paulseebach/go/pkg/mod'
GONOPROXY='github.com/askrella'
GONOSUMDB='github.com/askrella'
GOOS='darwin'
GOPATH='/Users/paulseebach/go'
GOPRIVATE='github.com/askrella'
GOPROXY='https://proxy.golang.org,direct'
GOROOT='/Users/paulseebach/.go'
GOSUMDB='sum.golang.org'
GOTMPDIR=''
GOTOOLCHAIN='auto'
GOTOOLDIR='/Users/paulseebach/.go/pkg/tool/darwin_arm64'
GOVCS=''
GOVERSION='go1.22.4'
GCCGO='gccgo'
AR='ar'
CC='clang'
CXX='clang++'
CGO_ENABLED='1'
GOMOD='/Users/paulseebach/code/askrella/simpleo-backend/go.mod'
GOWORK=''
CGO_CFLAGS='-O2 -g'
CGO_CPPFLAGS=''
CGO_CXXFLAGS='-O2 -g'
CGO_FFLAGS='-O2 -g'
CGO_LDFLAGS='-O2 -g'
PKG_CONFIG='pkg-config'
GOGCCFLAGS='-fPIC -arch arm64 -pthread -fno-caret-diagnostics -Qunused-arguments -fmessage-length=0 -ffile-prefix-map=/var/folders/l5/dt51qvv11wgdwbv18l68867r0000gn/T/go-build2194274985=/tmp/go-build -gno-record-gcc-switches -fno-common'
What did you do?
- added versioning with go's buildinfos
- built the binary locally with
go build ./cmd/local
- shipped it to dev (with CI/CD)
What did you see happen?
- VCS info in the BuildInfo locally worked fine
- VCS info wasn't present on dev
- comparing the build process and saw CI runs the built like this:
go build ./cmd/local/main.go
- tried it locally with
go build ./cmd/local/main.go
-> VCS Info wasn't present
What did you expect to see?
- when building the binary with
go build ./cmd/local/main.go
the VCS info should be present too
Comment From: gabyhelp
Similar Issues
- cmd/go: go test -buildvcs=true does not include vcs information #52648
- cmd/go: runtime/debug vcs build information not populated (OSX/git) #54042
- cmd/go: debug.BuildInfo doesn't include VCS info when cross-compiling [1.18rc1] #51264
- runtime/debug: vcs.modified populated in ReadBuildInfo for go install but not go build #51637
- cmd/go: binary does not contain VCS information when compiled in git worktree dir #58218
- cmd/go: vcs info not stamped when built listing .go files directly #51279
- go build uses wrong VCS information when running in a git worktree #64772
- runtime/debug: ReadBuildInfo returns no information about main module #51918
- cmd/go: missing result of ReadBuildInfo in init function #29628
- proposal: runtime/debug: embed vcs info into runtime/debug.BuildInfo when running go install #67745
(Emoji vote if this was helpful or unhelpful; more detailed feedback welcome in this discussion.)
Comment From: seankhliao
Duplicate of #51279