Skip to content

Commit 214b208

Browse files
dmitshurgopherbot
authored andcommitted
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 <[email protected]> LUCI-TryBot-Result: Go LUCI <[email protected]> Auto-Submit: Dmitri Shuralyov <[email protected]> Reviewed-by: Dmitri Shuralyov <[email protected]>
1 parent 3cebfb6 commit 214b208

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

src/cmd/go/internal/work/buildid.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -169,10 +169,10 @@ func (b *Builder) toolID(name string) string {
169169

170170
line := stdout.String()
171171
f := strings.Fields(line)
172-
if len(f) < 3 || f[0] != name && path != VetTool || f[1] != "version" || f[2] == "devel" && !strings.HasPrefix(f[len(f)-1], "buildID=") {
172+
if len(f) < 3 || f[0] != name && path != VetTool || f[1] != "version" || strings.Contains(f[2], "devel") && !strings.HasPrefix(f[len(f)-1], "buildID=") {
173173
base.Fatalf("go: parsing buildID from %s -V=full: unexpected output:\n\t%s", desc, line)
174174
}
175-
if f[2] == "devel" {
175+
if strings.Contains(f[2], "devel") {
176176
// On the development branch, use the content ID part of the build ID.
177177
return contentID(f[len(f)-1])
178178
}

src/cmd/internal/objabi/flag.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,7 @@ func (versionFlag) Set(s string) error {
113113
// build ID of the binary, so that if the compiler is changed and
114114
// rebuilt, we notice and rebuild all packages.
115115
if s == "full" {
116-
if strings.HasPrefix(buildcfg.Version, "devel") {
116+
if strings.Contains(buildcfg.Version, "devel") {
117117
p += " buildID=" + buildID
118118
}
119119
}

0 commit comments

Comments
 (0)