cmd/go: stamped (pseudo) version on build does not work for module in subdirectory #71738
Labels
BugReport
Issues describing a possible bug in the Go implementation.
FixPending
Issues that have a fix which has not yet been reviewed or submitted.
GoCommand
cmd/go
Milestone
Go version
go version go1.24.0 darwin/arm64
Output of
go env
in your module/workspace:What did you do?
Original report? #50603 (comment)
go mod init github.com/cshubhamrao/golang-experiments
subfolder
; rungo mod init github.com/cshubhamrao/golang-experiments/subfolder
git tag subfolder/v0.0.5
andgit tag v0.0.2
main.go
twice, one at repo root and once insidesubfolder
Code: https://github.com/cshubhamrao/golang-experiments/
commits and tags:
What did you see happen?
go run
from repo root❯ go run -buildvcs=true ./cmd H Module: github.com/cshubhamrao/golang-experiments Version: v0.0.2 Sum: GoVersion: go1.24.0 Dependencies: -buildmode exe -compiler gc CGO_ENABLED 1 CGO_CFLAGS CGO_CPPFLAGS CGO_CXXFLAGS CGO_LDFLAGS GOARCH arm64 GOOS darwin GOARM64 v8.0 vcs git vcs.revision 090bb9c9161d4b45adfe5d4e683b869d57827c53 vcs.time 2025-02-14T07:59:06Z vcs.modified false
go run
from subfolderWhat did you expect to see?
When run from
subfolder
, the module version reported should bev0.0.5
as the repo is also git-tagged assubfolder/v0.0.5
The text was updated successfully, but these errors were encountered: