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>
diff --git a/internal/internal.go b/internal/internal.go
index 995c5b6..1451e04 100644
--- a/internal/internal.go
+++ b/internal/internal.go
@@ -37,18 +37,3 @@
}
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
-}
diff --git a/internal/report/ghsa.go b/internal/report/ghsa.go
index 8872e1d..8825529 100644
--- a/internal/report/ghsa.go
+++ b/internal/report/ghsa.go
@@ -8,7 +8,6 @@
"fmt"
"strings"
- "golang.org/x/vulndb/internal"
"golang.org/x/vulndb/internal/ghsa"
)
@@ -112,7 +111,7 @@
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)
}