aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHana Kim <hyangah@gmail.com>2026-03-05 22:49:36 -0500
committerHyang-Ah Hana Kim <hyangah@gmail.com>2026-03-27 08:57:35 -0700
commit9174032bc85380974ae1ca0f1d18a1b76f775e3a (patch)
tree6439212df40e0b3e96f2c026878c779799f21437
parent2f49fcf74bb99c4d3870668e0713a4f70fa99e1b (diff)
downloadgo-x-pkgsite-9174032bc85380974ae1ca0f1d18a1b76f775e3a.tar.xz
all: run go fix -stringsseq
Change-Id: Id22b6fbc926c516043a2a9869ce9042dedebc725 Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/753433 Reviewed-by: Jonathan Amsterdam <jba@google.com> kokoro-CI: kokoro <noreply+kokoro@google.com> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
-rw-r--r--internal/config/serverconfig/config.go2
-rw-r--r--internal/fetch/package.go2
-rw-r--r--internal/postgres/search_test.go4
-rw-r--r--internal/stdlib/gorepo.go2
-rw-r--r--internal/tests/deps/cmd_pkgsite_deps_test.go12
-rw-r--r--internal/vuln/vulns.go2
6 files changed, 12 insertions, 12 deletions
diff --git a/internal/config/serverconfig/config.go b/internal/config/serverconfig/config.go
index 72715696..2ba2fc73 100644
--- a/internal/config/serverconfig/config.go
+++ b/internal/config/serverconfig/config.go
@@ -408,7 +408,7 @@ func gceMetadata(ctx context.Context, name string) (_ string, err error) {
func parseCommaList(s string) []string {
var a []string
- for _, p := range strings.Split(s, ",") {
+ for p := range strings.SplitSeq(s, ",") {
p = strings.TrimSpace(p)
if p != "" {
a = append(a, p)
diff --git a/internal/fetch/package.go b/internal/fetch/package.go
index eacfc6f8..fe300dc9 100644
--- a/internal/fetch/package.go
+++ b/internal/fetch/package.go
@@ -375,7 +375,7 @@ func extractPackageMetas(ctx context.Context, modulePath, resolvedVersion string
// working Go programs. We continue to ignore the "." and "testdata"
// cases, but we've seen valid Go packages with "_", so we accept those.
func ignoredByGoTool(importPath string) bool {
- for _, el := range strings.Split(importPath, "/") {
+ for el := range strings.SplitSeq(importPath, "/") {
if strings.HasPrefix(el, ".") || el == "testdata" {
return true
}
diff --git a/internal/postgres/search_test.go b/internal/postgres/search_test.go
index 915ad26e..9fd1db67 100644
--- a/internal/postgres/search_test.go
+++ b/internal/postgres/search_test.go
@@ -273,8 +273,8 @@ func TestPathTokens(t *testing.T) {
}
var got2 []string
- parts := strings.Split(tsv, "'")
- for _, p := range parts {
+ parts := strings.SplitSeq(tsv, "'")
+ for p := range parts {
p = strings.TrimSpace(p)
if p == "" {
continue
diff --git a/internal/stdlib/gorepo.go b/internal/stdlib/gorepo.go
index 9bfcda80..142ffc9f 100644
--- a/internal/stdlib/gorepo.go
+++ b/internal/stdlib/gorepo.go
@@ -90,7 +90,7 @@ func (remoteGoRepo) refs(ctx context.Context) ([]ref, error) {
func gitOutputToRefs(b []byte) ([]ref, error) {
var refs []ref
b = bytes.TrimSpace(b)
- for _, line := range bytes.Split(b, []byte("\n")) {
+ for line := range bytes.SplitSeq(b, []byte("\n")) {
fields := bytes.Fields(line)
if len(fields) != 2 {
return nil, fmt.Errorf("invalid line in output from git ls-remote: %q: should have two fields", line)
diff --git a/internal/tests/deps/cmd_pkgsite_deps_test.go b/internal/tests/deps/cmd_pkgsite_deps_test.go
index b6a73d8a..c82c4074 100644
--- a/internal/tests/deps/cmd_pkgsite_deps_test.go
+++ b/internal/tests/deps/cmd_pkgsite_deps_test.go
@@ -43,8 +43,8 @@ func TestCmdPkgsiteDeps(t *testing.T) {
t.Fatalf("running go list -test -deps on package golang.org/x/pkgsite/cmd/pkgsite: %v", err)
}
- pkgs := strings.Fields(string(out))
- for _, pkg := range pkgs {
+ pkgs := strings.FieldsSeq(string(out))
+ for pkg := range pkgs {
// Filter to only the dependencies that are in the pkgsite module.
if !strings.HasPrefix(pkg, "golang.org/x/pkgsite") {
continue
@@ -58,8 +58,8 @@ func TestCmdPkgsiteDeps(t *testing.T) {
}
t.Fatalf("running go list -test -deps on package %s: %v", pkg, err)
}
- testmodules := strings.Fields(string(out))
- for _, m := range testmodules {
+ testmodules := strings.FieldsSeq(string(out))
+ for m := range testmodules {
if !(allowedModDeps[m] || additionalAllowedTestModDeps[m]) {
t.Fatalf("disallowed test module dependency %q found through %q", m, pkg)
}
@@ -73,8 +73,8 @@ func TestCmdPkgsiteDeps(t *testing.T) {
}
t.Fatalf("running go list -deps on package %s: %v", pkg, err)
}
- modules := strings.Fields(string(out))
- for _, m := range modules {
+ modules := strings.FieldsSeq(string(out))
+ for m := range modules {
if !allowedModDeps[m] {
t.Fatalf("disallowed module dependency %q found through %q", m, pkg)
}
diff --git a/internal/vuln/vulns.go b/internal/vuln/vulns.go
index 2d944e60..19700b7f 100644
--- a/internal/vuln/vulns.go
+++ b/internal/vuln/vulns.go
@@ -184,7 +184,7 @@ func AffectedComponents(e *osv.Entry) (pkgs, modsNoPkgs []*AffectedComponent) {
func affectedSymbols(in []string) (e, u []string) {
for _, s := range in {
exported := true
- for _, part := range strings.Split(s, ".") {
+ for part := range strings.SplitSeq(s, ".") {
if !token.IsExported(part) {
exported = false // exported only if all parts of the symbol name are exported.
}