golang/go
View on GitHubcmd/go: vcs info not stamped when built listing .go files directly
Open
#51,279 opened on Feb 20, 2022
GoCommandNeedsInvestigationhelp wantedmodules
Repository metrics
- Stars
- (133,883 stars)
- PR merge metrics
- (No merged PRs in 30d)
Description
What version of Go are you using (go version)?
Does this issue reproduce with the latest release?
N/A
What operating system and processor architecture are you using (go env)?
What did you do?
git clone https://github.com/mlcdf/go-vcs-issue-repro.git
cd go-vcs-issue-repro
go1.18rc1 build main.go
.\main.exe
What did you expect to see?
VCS info appearing in the console : [{-compiler gc} {CGO_ENABLED 1} {CGO_CFLAGS } {CGO_CPPFLAGS } {CGO_CXXFLAGS } {CGO_LDFLAGS } {GOARCH amd64} {GOOS windows} {GOAMD64 v1} {vcs git} {vcs.revision 2d1c081410d0f5f23fd1dd7e08794041955a2119} {vcs.time 2022-02-20T11:01:47Z} {vcs.modified false}]
What did you see instead?
[{-compiler gc} {CGO_ENABLED 1} {CGO_CFLAGS } {CGO_CPPFLAGS } {CGO_CXXFLAGS } {CGO_LDFLAGS } {GOARCH amd64} {GOOS windows} {GOAMD64 v1}]
If I run go1.18rc1 build instead of go1.18rc1 build main.go and run the .\go-vcs-issue-repro.exe binary, it works fine. Is it expected behavior?