]> Cypherpunks repositories - gostls13.git/commitdiff
internal/goroot: using strings.CutPrefix replace strings.HasPrefix and strings.TrimPrefix
authorcuiweixie <cuiweixie@gmail.com>
Tue, 27 Sep 2022 07:58:33 +0000 (15:58 +0800)
committerGopher Robot <gobot@golang.org>
Tue, 27 Sep 2022 15:53:49 +0000 (15:53 +0000)
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>
src/internal/goroot/gc.go

index 79403d29fc02e55c30a929be3eee2478f02e6062..5517598519c18ca1047a4b52b0305b2255cc80b9 100644 (file)
@@ -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
                }
        }