Skip to content

Commit 789e798

Browse files
cuiweixiegopherbot
authored andcommitted
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 <[email protected]> TryBot-Result: Gopher Robot <[email protected]> Auto-Submit: Ian Lance Taylor <[email protected]> Run-TryBot: Ian Lance Taylor <[email protected]> Reviewed-by: Bryan Mills <[email protected]>
1 parent fac5338 commit 789e798

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/internal/goroot/gc.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -69,8 +69,8 @@ func (gd *gccgoDirs) init() {
6969
const prefix = "libraries: ="
7070
var dirs []string
7171
for _, dirEntry := range dirsEntries {
72-
if strings.HasPrefix(dirEntry, prefix) {
73-
dirs = filepath.SplitList(strings.TrimPrefix(dirEntry, prefix))
72+
if after, found := strings.CutPrefix(dirEntry, prefix); found {
73+
dirs = filepath.SplitList(after)
7474
break
7575
}
7676
}

0 commit comments

Comments
 (0)