aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorcuishuang <imcusg@gmail.com>2025-04-28 17:00:24 +0800
committerGopher Robot <gobot@golang.org>2025-10-23 07:31:44 -0700
commit107fcb70de859f7b8d08ce8bce8cf6a6d944aeff (patch)
tree6b0992a7566cdf9fb4d70374c2a0fada1e4d0576 /src
parent8378276d66060cf5486cda3c826afc4be9f4a047 (diff)
downloadgo-107fcb70de859f7b8d08ce8bce8cf6a6d944aeff.tar.xz
internal/goroot: replace HasPrefix+TrimPrefix with CutPrefix
Change-Id: I97305df6babbede57bb0c3b48c89c96cb74307f7 Reviewed-on: https://go-review.googlesource.com/c/go/+/668456 Auto-Submit: Sean Liao <sean@liao.dev> Reviewed-by: David Chase <drchase@google.com> Reviewed-by: Sean Liao <sean@liao.dev> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
Diffstat (limited to 'src')
-rw-r--r--src/internal/goroot/gc.go4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/internal/goroot/gc.go b/src/internal/goroot/gc.go
index 133d076391..534ad57e70 100644
--- a/src/internal/goroot/gc.go
+++ b/src/internal/goroot/gc.go
@@ -77,8 +77,8 @@ func (gd *gccgoDirs) init() {
const prefix = "libraries: ="
var dirs []string
for _, dirEntry := range dirsEntries {
- if strings.HasPrefix(dirEntry, prefix) {
- dirs = filepath.SplitList(strings.TrimPrefix(dirEntry, prefix))
+ if after, ok := strings.CutPrefix(dirEntry, prefix); ok {
+ dirs = filepath.SplitList(after)
break
}
}