aboutsummaryrefslogtreecommitdiff
path: root/internal/source/source.go
diff options
context:
space:
mode:
authorHana Kim <hyangah@gmail.com>2026-03-05 22:47:31 -0500
committerHyang-Ah Hana Kim <hyangah@gmail.com>2026-03-26 14:11:32 -0700
commit98258ff769bbca6f3d004ce80fabf5bff8f1136c (patch)
tree1ff3dccebdfc2df17009088688a1575383f68a42 /internal/source/source.go
parent34edebc0803b121acd1cbf363eef074e0a13ab6d (diff)
downloadgo-x-pkgsite-98258ff769bbca6f3d004ce80fabf5bff8f1136c.tar.xz
all: run go fix -slicescontains
Change-Id: I14479d9e612dfa7eed9188206746af5b51c10201 Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/753428 LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Jonathan Amsterdam <jba@google.com> kokoro-CI: kokoro <noreply+kokoro@google.com>
Diffstat (limited to 'internal/source/source.go')
-rw-r--r--internal/source/source.go9
1 files changed, 2 insertions, 7 deletions
diff --git a/internal/source/source.go b/internal/source/source.go
index 8c3d340c..b30ccc3b 100644
--- a/internal/source/source.go
+++ b/internal/source/source.go
@@ -28,6 +28,7 @@ import (
"path"
"path/filepath"
"regexp"
+ "slices"
"strconv"
"strings"
@@ -748,13 +749,7 @@ func init() {
for i := range patterns {
re := regexp.MustCompile(patterns[i].pattern)
// The pattern regexp must contain a group named "repo".
- found := false
- for _, n := range re.SubexpNames() {
- if n == "repo" {
- found = true
- break
- }
- }
+ found := slices.Contains(re.SubexpNames(), "repo")
if !found {
panic(fmt.Sprintf("pattern %s missing <repo> group", patterns[i].pattern))
}