*: modernize: stringsseq

go install golang.org/x/tools/go/analysis/passes/modernize/cmd/modernize@latest
    modernize -stringsseq -fix ./...

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
This commit is contained in:
Sebastiaan van Stijn committed 2026-03-15 18:24:13 +01:00
1 parent b050f47efc
commit 1754af311e
8 files changed
+13 -13

No files matched your search

+2 -2
View File
@@ -211,8 +211,8 @@ func validateTopic(topic string) error {
return fmt.Errorf("must have at least one component: %w", errdefs.ErrInvalidArgument)
}
components := strings.Split(topic[1:], "/")
for _, component := range components {
components := strings.SplitSeq(topic[1:], "/")
for component := range components {
if err := identifiers.Validate(component); err != nil {
return fmt.Errorf("failed validation on component %q: %w", component, err)
}
+1 -1
View File
@@ -729,7 +729,7 @@ func parseRange(s string, size int64) ([]httpRange, error) {
}
var ranges []httpRange
noOverlap := false
for _, ra := range strings.Split(s[len(b):], ",") {
for ra := range strings.SplitSeq(s[len(b):], ",") {
ra = textproto.TrimString(ra)
if ra == "" {
continue
+1 -1
View File
@@ -123,7 +123,7 @@ func selectRepositoryMountCandidate(refspec reference.Spec, sources map[string]s
n, match := 0, ""
components := strings.Split(target, "/")
for _, repo := range strings.Split(repoLabel, ",") {
for repo := range strings.SplitSeq(repoLabel, ",") {
// the target repo is not a candidate
if repo == target {
continue
+1 -1
View File
@@ -1374,7 +1374,7 @@ func getXxxset(t *testing.T, kind, path string) []string {
return nil
}
for _, rng := range strings.Split(strings.TrimSpace(string(data)), ",") {
for rng := range strings.SplitSeq(strings.TrimSpace(string(data)), ",") {
var (
lo int
hi = -1
+4 -4
View File
@@ -236,8 +236,8 @@ func ensureShared(path string, lookupMount func(string) (mount.Info, error)) err
}
// Make sure source mount point is shared.
optsSplit := strings.Split(mountInfo.Optional, " ")
for _, opt := range optsSplit {
optsSplit := strings.SplitSeq(mountInfo.Optional, " ")
for opt := range optsSplit {
if strings.HasPrefix(opt, "shared:") {
return nil
}
@@ -253,8 +253,8 @@ func ensureSharedOrSlave(path string, lookupMount func(string) (mount.Info, erro
return err
}
// Make sure source mount point is shared.
optsSplit := strings.Split(mountInfo.Optional, " ")
for _, opt := range optsSplit {
optsSplit := strings.SplitSeq(mountInfo.Optional, " ")
for opt := range optsSplit {
if strings.HasPrefix(opt, "shared:") {
return nil
} else if strings.HasPrefix(opt, "master:") {
@@ -83,7 +83,7 @@ func NewV4Options(req *http.Request) (*V4Options, error) {
if len(portString) == 0 {
return nil, fmt.Errorf("query parameter %q cannot be empty", api.PortHeader)
}
for _, p := range strings.Split(portString, ",") {
for p := range strings.SplitSeq(portString, ",") {
port, err := strconv.ParseUint(p, 10, 16)
if err != nil {
return nil, fmt.Errorf("unable to parse %q as a port: %v", portString, err)
+1 -1
View File
@@ -99,7 +99,7 @@ func (i *IDMap) Unmarshal(uidMap, gidMap string) error {
if len(str) == 0 {
return nil
}
for _, mapping := range strings.Split(str, ",") {
for mapping := range strings.SplitSeq(str, ",") {
m, err := deserializeLinuxIDMapping(mapping)
if err != nil {
return err
+2 -2
View File
@@ -367,8 +367,8 @@ func TestBinDirVerifyImage(t *testing.T) {
t.Fatal(err)
}
lines := strings.Split(string(b), "\n")
for _, l := range lines {
lines := strings.SplitSeq(string(b), "\n")
for l := range lines {
// Ignore defunct (zombie) verifier processes if PID 1 hasn't reaped them.
// TODO: Remove defunct check once containerd serves as subreaper for verifier processes.
if strings.Contains(l, "verifier-") && !strings.Contains(l, "<defunct>") {