From: Jes Cok Date: Sat, 23 Sep 2023 04:15:40 +0000 (+0000) Subject: go/build/constraint: delete, replace stringsCut calls with strings.Cut X-Git-Tag: go1.22rc1~740 X-Git-Url: http://www.git.cypherpunks.su/?a=commitdiff_plain;h=66959a59342d323273f398e92165e2ec165ef3e8;p=gostls13.git go/build/constraint: delete, replace stringsCut calls with strings.Cut Currently, the Go bootstrap toolchain is bumped to 1.20. Change-Id: I6467768c0640a8e9aadbfea79cfdfb14b4b80679 GitHub-Last-Rev: 7cf2d54a4865b4c6c15af374a6c0fbdbcce8c3b6 GitHub-Pull-Request: golang/go#63174 Reviewed-on: https://go-review.googlesource.com/c/go/+/530676 LUCI-TryBot-Result: Go LUCI Reviewed-by: Ian Lance Taylor Reviewed-by: Than McIntosh Reviewed-by: qiulaidongfeng <2645477756@qq.com> Auto-Submit: Ian Lance Taylor --- diff --git a/src/go/build/constraint/vers.go b/src/go/build/constraint/vers.go index 34c44dcf17..c8421885a6 100644 --- a/src/go/build/constraint/vers.go +++ b/src/go/build/constraint/vers.go @@ -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.