From 58f92708c2ec8f401e2905c4f2e26821650560bd Mon Sep 17 00:00:00 2001 From: Michael Eischer Date: Wed, 22 Jul 2026 22:27:07 +0200 Subject: [PATCH] Apply go fix -stringsseq ./... --- cmd/restic/cmd_backup_integration_test.go | 2 +- cmd/restic/cmd_rewrite_integration_test.go | 2 +- internal/backend/sftp/sftp_test.go | 2 +- internal/data/snapshot_group.go | 2 +- internal/data/tag_list.go | 2 +- internal/debug/debug.go | 2 +- internal/feature/features.go | 2 +- internal/fs/fs_local_vss.go | 2 +- internal/test/vars.go | 2 +- internal/ui/table/table.go | 4 ++-- 10 files changed, 11 insertions(+), 11 deletions(-) diff --git a/cmd/restic/cmd_backup_integration_test.go b/cmd/restic/cmd_backup_integration_test.go index ffb7f675f..190d9cc94 100644 --- a/cmd/restic/cmd_backup_integration_test.go +++ b/cmd/restic/cmd_backup_integration_test.go @@ -755,7 +755,7 @@ func TestBackupExcludeWithOutput(t *testing.T) { rtest.OK(t, err) foundExclude := false - for _, line := range bytes.Split(output, []byte("\n")) { + for line := range bytes.SplitSeq(output, []byte("\n")) { if len(line) == 0 { continue } diff --git a/cmd/restic/cmd_rewrite_integration_test.go b/cmd/restic/cmd_rewrite_integration_test.go index e30f437b2..cc575cd3b 100644 --- a/cmd/restic/cmd_rewrite_integration_test.go +++ b/cmd/restic/cmd_rewrite_integration_test.go @@ -43,7 +43,7 @@ func testLsOutputContainsCount(t testing.TB, gopts global.Options, lsOpts LsOpti t.Helper() out := testRunLsWithOpts(t, gopts, lsOpts, lsArgs) count := 0 - for _, line := range strings.Split(string(out), "\n") { + for line := range strings.SplitSeq(string(out), "\n") { if strings.Contains(line, substring) { count++ } diff --git a/internal/backend/sftp/sftp_test.go b/internal/backend/sftp/sftp_test.go index 1d4fde095..2e88b162a 100644 --- a/internal/backend/sftp/sftp_test.go +++ b/internal/backend/sftp/sftp_test.go @@ -17,7 +17,7 @@ import ( ) func findSFTPServerBinary() string { - for _, dir := range strings.Split(rtest.TestSFTPPath, ":") { + for dir := range strings.SplitSeq(rtest.TestSFTPPath, ":") { testpath := filepath.Join(dir, "sftp-server") _, err := os.Stat(testpath) if !errors.Is(err, os.ErrNotExist) { diff --git a/internal/data/snapshot_group.go b/internal/data/snapshot_group.go index ca4b0aabc..620e153f5 100644 --- a/internal/data/snapshot_group.go +++ b/internal/data/snapshot_group.go @@ -15,7 +15,7 @@ type SnapshotGroupByOptions struct { func splitSnapshotGroupBy(s string) (SnapshotGroupByOptions, error) { var l SnapshotGroupByOptions - for _, option := range strings.Split(s, ",") { + for option := range strings.SplitSeq(s, ",") { switch option { case "host", "hosts": l.Host = true diff --git a/internal/data/tag_list.go b/internal/data/tag_list.go index b31072d94..ec02f7e1b 100644 --- a/internal/data/tag_list.go +++ b/internal/data/tag_list.go @@ -12,7 +12,7 @@ type TagList []string // need to be separated by commas. Whitespace is stripped around the individual // tags. func splitTagList(s string) (l TagList) { - for _, t := range strings.Split(s, ",") { + for t := range strings.SplitSeq(s, ",") { l = append(l, strings.TrimSpace(t)) } return l diff --git a/internal/debug/debug.go b/internal/debug/debug.go index 0bcfbc81b..5e4f8aad0 100644 --- a/internal/debug/debug.go +++ b/internal/debug/debug.go @@ -61,7 +61,7 @@ func parseFilter(envname string, pad func(string) string) map[string]bool { return filter } - for _, fn := range strings.Split(env, ",") { + for fn := range strings.SplitSeq(env, ",") { t := pad(strings.TrimSpace(fn)) val := true switch t[0] { diff --git a/internal/feature/features.go b/internal/feature/features.go index e3b625e92..ea5d76ef7 100644 --- a/internal/feature/features.go +++ b/internal/feature/features.go @@ -64,7 +64,7 @@ func (f *FlagSet) Apply(flags string, logWarning func(string)) error { selection := make(map[string]bool) - for _, flag := range strings.Split(flags, ",") { + for flag := range strings.SplitSeq(flags, ",") { parts := strings.SplitN(flag, "=", 2) name := parts[0] diff --git a/internal/fs/fs_local_vss.go b/internal/fs/fs_local_vss.go index cc4074f79..e0b04ac8f 100644 --- a/internal/fs/fs_local_vss.go +++ b/internal/fs/fs_local_vss.go @@ -72,7 +72,7 @@ func parseMountPoints(list string, msgError ErrorHandler) (volumes map[string]st if list == "" { return } - for _, s := range strings.Split(list, ";") { + for s := range strings.SplitSeq(list, ";") { if v, err := getVolumeNameForVolumeMountPoint(s); err != nil { msgError(s, errors.Errorf("failed to parse vss.exclude-volumes [%s]: %s", s, err)) } else { diff --git a/internal/test/vars.go b/internal/test/vars.go index f3c740d46..2d2e25905 100644 --- a/internal/test/vars.go +++ b/internal/test/vars.go @@ -46,7 +46,7 @@ func getBoolVar(name string, defaultValue bool) bool { // names that must be run. If name is in this list, the test is marked as // failed. func SkipDisallowed(t testing.TB, name string) { - for _, s := range strings.Split(testIntegrationDisallowSkip, ",") { + for s := range strings.SplitSeq(testIntegrationDisallowSkip, ",") { if s == name { t.Fatalf("test %v is in list of tests that need to run ($RESTIC_TEST_DISALLOW_SKIP)", name) } diff --git a/internal/ui/table/table.go b/internal/ui/table/table.go index de8b93e98..80ad1eba4 100644 --- a/internal/ui/table/table.go +++ b/internal/ui/table/table.go @@ -139,7 +139,7 @@ func (t *Table) Write(w io.Writer) error { // find max width for each cell columnWidths := make([]int, columns) for i, desc := range t.columns { - for _, line := range strings.Split(desc, "\n") { + for line := range strings.SplitSeq(desc, "\n") { width := ui.DisplayWidth(line) if columnWidths[i] < width { columnWidths[i] = width @@ -148,7 +148,7 @@ func (t *Table) Write(w io.Writer) error { } for _, line := range lines { for i, content := range line { - for _, l := range strings.Split(content, "\n") { + for l := range strings.SplitSeq(content, "\n") { width := ui.DisplayWidth(l) if columnWidths[i] < width { columnWidths[i] = width