mirror of
https://github.com/golang/go.git
synced 2025-12-08 06:10:04 +00:00
go/version: use "custom" as an example of a version suffix
The suffix in a non-standard toolchain version can be any string. Show more of a middle ground example of a non-standard version suffix, aligning it with the example used at https://go.dev/doc/toolchain#name. For #75953. Change-Id: I98f9c4de98316aecf76c017eb13cf25582c8939c Reviewed-on: https://go-review.googlesource.com/c/go/+/720621 Reviewed-by: Quim Muntal <quimmuntal@gmail.com> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Auto-Submit: Dmitri Shuralyov <dmitshur@golang.org> Reviewed-by: Mark Freeman <markfreeman@google.com> Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
This commit is contained in:
parent
c4bb9653ba
commit
ab59569099
1 changed files with 3 additions and 3 deletions
|
|
@ -4,7 +4,7 @@
|
||||||
|
|
||||||
// Package version provides operations on [Go versions]
|
// Package version provides operations on [Go versions]
|
||||||
// in [Go toolchain name syntax]: strings like
|
// in [Go toolchain name syntax]: strings like
|
||||||
// "go1.20", "go1.21.0", "go1.22rc2", and "go1.23.4-bigcorp".
|
// "go1.20", "go1.21.0", "go1.22rc2", and "go1.23.4-custom".
|
||||||
//
|
//
|
||||||
// [Go versions]: https://go.dev/doc/toolchain#version
|
// [Go versions]: https://go.dev/doc/toolchain#version
|
||||||
// [Go toolchain name syntax]: https://go.dev/doc/toolchain#name
|
// [Go toolchain name syntax]: https://go.dev/doc/toolchain#name
|
||||||
|
|
@ -15,10 +15,10 @@ import (
|
||||||
"strings"
|
"strings"
|
||||||
)
|
)
|
||||||
|
|
||||||
// stripGo converts from a "go1.21-bigcorp" version to a "1.21" version.
|
// stripGo converts from a "go1.21-custom" version to a "1.21" version.
|
||||||
// If v does not start with "go", stripGo returns the empty string (a known invalid version).
|
// If v does not start with "go", stripGo returns the empty string (a known invalid version).
|
||||||
func stripGo(v string) string {
|
func stripGo(v string) string {
|
||||||
v, _, _ = strings.Cut(v, "-") // strip -bigcorp suffix.
|
v, _, _ = strings.Cut(v, "-") // strip -custom suffix.
|
||||||
if len(v) < 2 || v[:2] != "go" {
|
if len(v) < 2 || v[:2] != "go" {
|
||||||
return ""
|
return ""
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue