]> Cypherpunks repositories - gostls13.git/commitdiff
cmd/go, cmd/internal/objabi: detect "devel" version by substring
authorDmitri Shuralyov <dmitshur@golang.org>
Fri, 25 Apr 2025 23:43:16 +0000 (19:43 -0400)
committerGopher Robot <gobot@golang.org>
Wed, 30 Apr 2025 18:07:24 +0000 (11:07 -0700)
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>
src/cmd/go/internal/work/buildid.go
src/cmd/internal/objabi/flag.go

index 3497ad7a27dc3f3d56d420ba5b610ebe3c599858..9bf3ab9acc3246ede3e2ad321d5fb225f95b834a 100644 (file)
@@ -169,10 +169,10 @@ func (b *Builder) toolID(name string) string {
 
                line := stdout.String()
                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)
                }
-               if f[2] == "devel" {
+               if strings.Contains(f[2], "devel") {
                        // On the development branch, use the content ID part of the build ID.
                        return contentID(f[len(f)-1])
                }
index cfd86dc6dc4a7e3bedc80a3078bbaf97d742f24b..1bb46e3bcdc01b642e2341662966ddc5021d294f 100644 (file)
@@ -113,7 +113,7 @@ func (versionFlag) Set(s string) error {
        // build ID of the binary, so that if the compiler is changed and
        // rebuilt, we notice and rebuild all packages.
        if s == "full" {
-               if strings.HasPrefix(buildcfg.Version, "devel") {
+               if strings.Contains(buildcfg.Version, "devel") {
                        p += " buildID=" + buildID
                }
        }