Apply go fix -rangeint ./...

This commit is contained in:
Michael Eischer
2026-07-22 22:26:19 +02:00
parent fb36a7f59b
commit 2c169edad4
56 changed files with 91 additions and 91 deletions
+2 -2
View File
@@ -154,7 +154,7 @@ func (f *vssDeleteOriginalFS) Lstat(name string) (*fs.ExtendedFileInfo, error) {
_, _ = f.FS.Lstat(name)
// nuke testdata
var err error
for i := 0; i < 3; i++ {
for range 3 {
// The CI sometimes runs into "The process cannot access the file because it is being used by another process" errors
// thus try a few times to remove the data
err = os.RemoveAll(f.testdata)
@@ -738,7 +738,7 @@ func TestBackupSkipIfUnchanged(t *testing.T) {
testSetupBackupData(t, env)
opts := BackupOptions{SkipIfUnchanged: true}
for i := 0; i < 3; i++ {
for range 3 {
testRunBackup(t, filepath.Dir(env.testdata), []string{"testdata"}, opts, env.gopts)
testListSnapshots(t, env.gopts, 1)
}
+2 -2
View File
@@ -46,7 +46,7 @@ func snapshotsDirExists(t testing.TB, dir string) bool {
// waitForMount blocks (max mountWait * mountSleep) until the subdir
// "snapshots" appears in the dir.
func waitForMount(t testing.TB, dir string) {
for i := 0; i < mountWait; i++ {
for range mountWait {
if snapshotsDirExists(t, dir) {
t.Log("mounted directory is ready")
return
@@ -70,7 +70,7 @@ func testRunMount(t testing.TB, gopts global.Options, dir string, wg *sync.WaitG
func testRunUmount(t testing.TB, dir string) {
var err error
for i := 0; i < mountWait; i++ {
for range mountWait {
if err = systemFuse.Unmount(dir); err == nil {
t.Logf("directory %v umounted", dir)
return
+1 -1
View File
@@ -243,7 +243,7 @@ func TestRestore(t *testing.T) {
testRunInit(t, env.gopts)
for i := 0; i < 10; i++ {
for i := range 10 {
p := filepath.Join(env.testdata, fmt.Sprintf("foo/bar/testfile%v", i))
rtest.OK(t, os.MkdirAll(filepath.Dir(p), 0755))
rtest.OK(t, appendRandomData(p, uint(rand.Intn(2<<21))))
+1 -1
View File
@@ -415,7 +415,7 @@ func statsDebugFileType(ctx context.Context, repo restic.Lister, tpe restic.File
func statsDebugBlobs(ctx context.Context, repo restic.Repository) ([restic.NumBlobTypes]*sizeHistogram, error) {
var hist [restic.NumBlobTypes]*sizeHistogram
for i := 0; i < len(hist); i++ {
for i := range len(hist) {
hist[i] = newSizeHistogram(2 * chunker.MaxSize)
}
+1 -1
View File
@@ -24,7 +24,7 @@ func TestSizeHistogramNew(t *testing.T) {
func TestSizeHistogramAdd(t *testing.T) {
h := newSizeHistogram(42)
for i := uint64(0); i < 45; i++ {
for i := range uint64(45) {
h.Add(i)
}