cmd/go, cmd/internal/objabi: detect "devel" version by substring

These were the remaining instances in the main Go repo I found where a
Go version like "devel go1.25-9ce47e66e8 Wed Mar 26 03:48:50 2025 -0700"
is considered to be a development version rather than a release version,
but the version "go1.25-devel_9ce47e66e8 Wed Mar 26 03:48:50 2025 -0700"
is not.

Update this in preparation of the move of "devel" from front to middle.

For #73372.
For #73369.

Change-Id: If5442ecb0751c08b3a1b4d1148193e501700b956
Cq-Include-Trybots: luci.golang.try:gotip-linux-amd64-longtest
Reviewed-on: https://go-review.googlesource.com/c/go/+/668355
Reviewed-by: Michael Matloob <matloob@golang.org>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Auto-Submit: Dmitri Shuralyov <dmitshur@golang.org>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
This commit is contained in:
Dmitri Shuralyov 2025-04-25 19:43:16 -04:00 committed by Gopher Robot
parent 3cebfb678b
commit 214b208e24
2 changed files with 3 additions and 3 deletions

View File

@ -169,10 +169,10 @@ func (b *Builder) toolID(name string) string {
line := stdout.String() line := stdout.String()
f := strings.Fields(line) f := strings.Fields(line)
if len(f) < 3 || f[0] != name && path != VetTool || f[1] != "version" || f[2] == "devel" && !strings.HasPrefix(f[len(f)-1], "buildID=") { if len(f) < 3 || f[0] != name && path != VetTool || f[1] != "version" || strings.Contains(f[2], "devel") && !strings.HasPrefix(f[len(f)-1], "buildID=") {
base.Fatalf("go: parsing buildID from %s -V=full: unexpected output:\n\t%s", desc, line) base.Fatalf("go: parsing buildID from %s -V=full: unexpected output:\n\t%s", desc, line)
} }
if f[2] == "devel" { if strings.Contains(f[2], "devel") {
// On the development branch, use the content ID part of the build ID. // On the development branch, use the content ID part of the build ID.
return contentID(f[len(f)-1]) return contentID(f[len(f)-1])
} }

View File

@ -113,7 +113,7 @@ func (versionFlag) Set(s string) error {
// build ID of the binary, so that if the compiler is changed and // build ID of the binary, so that if the compiler is changed and
// rebuilt, we notice and rebuild all packages. // rebuilt, we notice and rebuild all packages.
if s == "full" { if s == "full" {
if strings.HasPrefix(buildcfg.Version, "devel") { if strings.Contains(buildcfg.Version, "devel") {
p += " buildID=" + buildID p += " buildID=" + buildID
} }
} }