aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorcuiweixie <cuiweixie@gmail.com>2022-09-27 15:58:33 +0800
committerGopher Robot <gobot@golang.org>2022-09-27 15:53:49 +0000
commit789e798f0436361bfe8ca492a933cfeb17d2780c (patch)
tree0935e0e12281908f8981ba1842718aa973d8dc3c /src
parentfac5338a6c788df948edafa055ed998c46ba545e (diff)
downloadgo-789e798f0436361bfe8ca492a933cfeb17d2780c.tar.xz
internal/goroot: using strings.CutPrefix replace strings.HasPrefix and strings.TrimPrefix
Change-Id: I63b2af955e2ada6d20e72c10797576d93bbc7e71 Reviewed-on: https://go-review.googlesource.com/c/go/+/435135 Reviewed-by: Ian Lance Taylor <iant@google.com> TryBot-Result: Gopher Robot <gobot@golang.org> Auto-Submit: Ian Lance Taylor <iant@google.com> Run-TryBot: Ian Lance Taylor <iant@google.com> Reviewed-by: Bryan Mills <bcmills@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 79403d29fc..5517598519 100644
--- a/src/internal/goroot/gc.go
+++ b/src/internal/goroot/gc.go
@@ -69,8 +69,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, found := strings.CutPrefix(dirEntry, prefix); found {
+ dirs = filepath.SplitList(after)
break
}
}