Skip to content

Commit b48e52b

Browse files
dmitshurgopherbot
authored andcommitted
cmd/dist: move "devel" substring in git-inferred development version
Keep the property that the "devel" substring is always present in these development versions of Go, but also gain the property that it's viable to use functions in the go/version package such as Lang, Compare, and get the expected results without needing to trim the "devel " prefix. For #73369. For #41116. Fixes #73372. Change-Id: Ieea4692e8c6cf0135e010f49f85300f6b038d6b1 Cq-Include-Trybots: luci.golang.try:gotip-linux-amd64-longtest Reviewed-on: https://go-review.googlesource.com/c/go/+/668015 Reviewed-by: Funda Secgin <[email protected]> LUCI-TryBot-Result: Go LUCI <[email protected]> Reviewed-by: Dmitri Shuralyov <[email protected]> Auto-Submit: Dmitri Shuralyov <[email protected]> Reviewed-by: Michael Pratt <[email protected]>
1 parent 12e5efd commit b48e52b

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

src/cmd/dist/build.go

+5-1
Original file line numberDiff line numberDiff line change
@@ -426,6 +426,10 @@ func findgoversion() string {
426426
// Otherwise, use Git.
427427
//
428428
// Include 1.x base version, hash, and date in the version.
429+
// Make sure it includes the substring "devel", but otherwise
430+
// use a format compatible with https://go.dev/doc/toolchain#name
431+
// so that it's possible to use go/version.Lang, Compare and so on.
432+
// See go.dev/issue/73372.
429433
//
430434
// Note that we lightly parse internal/goversion/goversion.go to
431435
// obtain the base version. We can't just import the package,
@@ -437,7 +441,7 @@ func findgoversion() string {
437441
if m == nil {
438442
fatalf("internal/goversion/goversion.go does not contain 'const Version = ...'")
439443
}
440-
version := fmt.Sprintf("devel go1.%s-", m[1])
444+
version := fmt.Sprintf("go1.%s-devel_", m[1])
441445
version += chomp(run(goroot, CheckExit, "git", "log", "-n", "1", "--format=format:%h %cd", "HEAD"))
442446

443447
// Cache version.

0 commit comments

Comments
 (0)