]> Cypherpunks repositories - gostls13.git/commit
cmd/go: fix version stamping for v2 modules and subdirectories
authorSam Thanawalla <samthanawalla@google.com>
Mon, 31 Mar 2025 19:06:43 +0000 (19:06 +0000)
committerSam Thanawalla <samthanawalla@google.com>
Mon, 7 Apr 2025 18:29:57 +0000 (11:29 -0700)
commitd584d2b3dda9ab88a51a3e9cffe8ecd140479cef
tree8893ec5c532dd9e499dba6f6edf254b7820e454e
parenta08d2db6d1b8a46d2fc909b848da20ef1b8f5e8f
cmd/go: fix version stamping for v2 modules and subdirectories

We were not passing the module path to newCodeRepo which caused it to
incorrectly parse the major version. This allowed v0 and v1 modules to
work because an empty major version is allowed in that case.

Additionally we need to pass the root module path to derive the correct tag
for subdirectories.

Fixes: #72877
Fixes: #71738
Change-Id: Id792923f426858513972e713623270edbc76c545
Reviewed-on: https://go-review.googlesource.com/c/go/+/661875
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Michael Matloob <matloob@golang.org>
src/cmd/go/internal/load/pkg.go
src/cmd/go/internal/modfetch/repo.go
src/cmd/go/testdata/script/build_version_stamping_git.txt
src/cmd/go/testdata/script/version_buildvcs_bzr.txt
src/cmd/go/testdata/script/version_buildvcs_hg.txt