mirror of
https://github.com/golang/go
synced 2024-09-15 22:20:06 +00:00
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>
This commit is contained in:
parent
fac5338a6c
commit
789e798f04
|
@ -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
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue