зеркало из https://github.com/golang/vulndb.git
x/vulndb: replace internal.Cut with strings.Cut
Remove function internal.Cut and replace with strings.Cut which was introduced in Go 1.18. Fixes golang/go#52571 Change-Id: I0fa926cfc7cd7ecf69ab1ebbc0c852dc22741a12 Reviewed-on: https://go-review.googlesource.com/c/vulndb/+/402414 Run-TryBot: Tatiana Bradley <tatiana@golang.org> TryBot-Result: Gopher Robot <gobot@golang.org> Reviewed-by: Jonathan Amsterdam <jba@google.com> Reviewed-by: Tatiana Bradley <tatiana@golang.org>
This commit is contained in:
Родитель
8dc5b8acda
Коммит
819f17d941
|
@ -37,18 +37,3 @@ func ReadFileLines(filename string) (lines []string, err error) {
|
|||
}
|
||||
return lines, nil
|
||||
}
|
||||
|
||||
// Cut cuts s around the first instance of sep,
|
||||
// returning the text before and after sep.
|
||||
// The found result reports whether sep appears in s.
|
||||
// If sep does not appear in s, cut returns s, "", false.
|
||||
//
|
||||
// https://golang.org/issue/46336 is an accepted proposal to add this to the
|
||||
// standard library. It will presumably land in Go 1.18, so this can be removed
|
||||
// when pkgsite moves to that version.
|
||||
func Cut(s, sep string) (before, after string, found bool) {
|
||||
if i := strings.Index(s, sep); i >= 0 {
|
||||
return s[:i], s[i+len(sep):], true
|
||||
}
|
||||
return s, "", false
|
||||
}
|
||||
|
|
|
@ -8,7 +8,6 @@ import (
|
|||
"fmt"
|
||||
"strings"
|
||||
|
||||
"golang.org/x/vulndb/internal"
|
||||
"golang.org/x/vulndb/internal/ghsa"
|
||||
)
|
||||
|
||||
|
@ -112,7 +111,7 @@ func parseVulnRange(s string) ([]vulnRangeItem, error) {
|
|||
if p == "" {
|
||||
continue
|
||||
}
|
||||
before, after, found := internal.Cut(p, " ")
|
||||
before, after, found := strings.Cut(p, " ")
|
||||
if !found {
|
||||
return nil, fmt.Errorf("invalid vuln range item %q", p)
|
||||
}
|
||||
|
|
Загрузка…
Ссылка в новой задаче