1
0
mirror of https://github.com/golang/go synced 2024-11-23 03:30:02 -07:00

go/build/constraint: delete and replace stringsCut calls with strings.Cut

Currently, the Go bootstrap toolchain is bumped to 1.20.
This commit is contained in:
Jes Cok 2023-09-23 12:07:00 +08:00
parent 54f78cf8f1
commit 7cf2d54a48

View File

@ -66,7 +66,7 @@ func minVersion(z Expr, sign int) int {
if z.Tag == "go1" {
return 0
}
_, v, _ := stringsCut(z.Tag, "go1.")
_, v, _ := strings.Cut(z.Tag, "go1.")
n, err := strconv.Atoi(v)
if err != nil {
// not a go1.N tag
@ -76,14 +76,6 @@ func minVersion(z Expr, sign int) int {
}
}
// TODO: Delete, replace calls with strings.Cut once Go bootstrap toolchain is bumped.
func stringsCut(s, sep string) (before, after string, found bool) {
if i := strings.Index(s, sep); i >= 0 {
return s[:i], s[i+len(sep):], true
}
return s, "", false
}
// andVersion returns the minimum Go version
// implied by the AND of two minimum Go versions,
// which is the max of the versions.