mirror of
https://github.com/restic/restic.git
synced 2026-08-06 13:43:18 +00:00
Apply go fix -stringsseq ./...
This commit is contained in:
@@ -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
|
||||
}
|
||||
|
||||
@@ -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++
|
||||
}
|
||||
|
||||
@@ -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) {
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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] {
|
||||
|
||||
@@ -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]
|
||||
|
||||
@@ -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 {
|
||||
|
||||
@@ -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)
|
||||
}
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user