Skip to content

Commit

Permalink
Remove extra loop var copies
Browse files Browse the repository at this point in the history
  • Loading branch information
sevein committed Feb 8, 2024
1 parent 3c851dd commit 0c1b843
Show file tree
Hide file tree
Showing 17 changed files with 3 additions and 27 deletions.
3 changes: 3 additions & 0 deletions .golangci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -42,3 +42,6 @@ linters-settings:
exclude-generated: false
severity: low
confidence: low
govet:
disable:
- loopclosure
1 change: 0 additions & 1 deletion internal/am/delete_transfer_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,6 @@ func TestDeleteTransferActivity(t *testing.T) {
errMsg: fmt.Sprintf("delete transfer: path: %q: %v", td.Join(filename), errors.New("SSH: failed to connect: dial tcp 127.0.0.1:2200: connect: connection refused")),
},
} {
tt := tt
t.Run(tt.name, func(t *testing.T) {
t.Parallel()

Expand Down
2 changes: 0 additions & 2 deletions internal/am/job_tracker_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,6 @@ func TestJobTracker(t *testing.T) {
wantErr: "invalid Archivematica credentials",
},
} {
tt := tt
t.Run(tt.name, func(t *testing.T) {
t.Parallel()

Expand Down Expand Up @@ -270,7 +269,6 @@ func TestConvertJobToPreservationTask(t *testing.T) {
want: package_.PreservationTask{},
},
} {
tt := tt
t.Run(tt.name, func(t *testing.T) {
t.Parallel()

Expand Down
1 change: 0 additions & 1 deletion internal/am/poll_ingest_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -239,7 +239,6 @@ func TestPollIngestActivity(t *testing.T) {
wantErr: "Archivematica resource not found",
},
} {
tt := tt
t.Run(tt.name, func(t *testing.T) {
t.Parallel()

Expand Down
1 change: 0 additions & 1 deletion internal/am/poll_transfer_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -271,7 +271,6 @@ func TestPollTransferActivity(t *testing.T) {
wantErr: "Archivematica resource not found",
},
} {
tt := tt
t.Run(tt.name, func(t *testing.T) {
t.Parallel()

Expand Down
1 change: 0 additions & 1 deletion internal/am/start_transfer_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,6 @@ func TestStartTransferActivity(t *testing.T) {
errMsg: "Archivematica resource not found",
},
} {
tt := tt
t.Run(tt.name, func(t *testing.T) {
t.Parallel()

Expand Down
1 change: 0 additions & 1 deletion internal/am/upload_transfer_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,6 @@ func TestUploadTransferActivity(t *testing.T) {
wantNonRetryErr: true,
},
} {
tt := tt
t.Run(tt.name, func(t *testing.T) {
t.Parallel()

Expand Down
1 change: 0 additions & 1 deletion internal/package_/status_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,6 @@ func TestStatus(t *testing.T) {
},
}
for _, tc := range tests {
tc := tc
t.Run(fmt.Sprintf("Status_%s", tc.str), func(t *testing.T) {
s := NewStatus(tc.str)
assert.Assert(t, s != StatusUnknown)
Expand Down
2 changes: 0 additions & 2 deletions internal/persistence/ent/client/client_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,6 @@ func TestCreatePackage(t *testing.T) {
},
}
for _, tt := range tests {
tt := tt
t.Run(tt.name, func(t *testing.T) {
t.Parallel()

Expand Down Expand Up @@ -370,7 +369,6 @@ func TestUpdatePackage(t *testing.T) {
},
}
for _, tt := range tests {
tt := tt
t.Run(tt.name, func(t *testing.T) {
t.Parallel()

Expand Down
2 changes: 0 additions & 2 deletions internal/sftp/goclient_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -298,7 +298,6 @@ func TestUpload(t *testing.T) {
},
},
} {
tc := tc
t.Run(tc.name, func(t *testing.T) {
t.Parallel()

Expand Down Expand Up @@ -379,7 +378,6 @@ func TestDelete(t *testing.T) {
wantErr: "SFTP: unable to remove file \"restricted/test.txt\": permission denied",
},
} {
tc := tc
t.Run(tc.name, func(t *testing.T) {
t.Parallel()

Expand Down
6 changes: 0 additions & 6 deletions internal/storage/location_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,6 @@ func TestNewInternalLocation(t *testing.T) {
},
}
for _, tc := range tests {
tc := tc

t.Run(tc.name, func(t *testing.T) {
t.Parallel()

Expand Down Expand Up @@ -108,8 +106,6 @@ func TestNewLocation(t *testing.T) {
},
}
for _, tc := range tests {
tc := tc

t.Run(tc.name, func(t *testing.T) {
t.Parallel()

Expand Down Expand Up @@ -158,8 +154,6 @@ func TestLocation_Bucket(t *testing.T) {
},
}
for _, tc := range tests {
tc := tc

t.Run(tc.name, func(t *testing.T) {
t.Parallel()

Expand Down
2 changes: 0 additions & 2 deletions internal/storage/types/location_config_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,6 @@ func TestLocationConfigEncoding(t *testing.T) {
wantErr: "json: error calling MarshalJSON for type types.LocationConfig: unsupported config type: <nil>",
},
} {
tt := tt
t.Run(name, func(t *testing.T) {
t.Parallel()

Expand Down Expand Up @@ -210,7 +209,6 @@ func TestLocationConfigDecoding(t *testing.T) {
wantErr: "multiple config values have been assigned",
},
} {
tt := tt
t.Run(name, func(t *testing.T) {
t.Parallel()

Expand Down
1 change: 0 additions & 1 deletion internal/storage/types/status_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,6 @@ func TestPackageStatus(t *testing.T) {
status: types.StatusMoving,
},
} {
tt := tt
t.Run(tt.code, func(t *testing.T) {
t.Parallel()

Expand Down
3 changes: 0 additions & 3 deletions internal/watcher/watcher.go
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,6 @@ func New(ctx context.Context, logger logr.Logger, c *Config) (*serviceImpl, erro
minioConfigs := append(c.Minio, c.Embedded)

for _, item := range minioConfigs {
item := item
w, err := NewMinioWatcher(ctx, logger, item)
if err != nil {
return nil, err
Expand All @@ -105,7 +104,6 @@ func New(ctx context.Context, logger logr.Logger, c *Config) (*serviceImpl, erro
}

for _, item := range c.Filesystem {
item := item
w, err := NewFilesystemWatcher(ctx, item)
if err != nil {
return nil, err
Expand All @@ -127,7 +125,6 @@ func (svc *serviceImpl) Watchers() []Watcher {

ww := []Watcher{}
for _, item := range svc.watchers {
item := item
ww = append(ww, item)
}

Expand Down
1 change: 0 additions & 1 deletion internal/workflow/activities/bundle_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,6 @@ e91f941be5973ff71f1dccbdd1a32d598881893a7f21be516aca743da38b1689 bagit.txt
),
},
} {
tt := tt
t.Run(tt.name, func(t *testing.T) {
t.Parallel()

Expand Down
1 change: 0 additions & 1 deletion internal/workflow/activities/download_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,6 @@ func TestDownloadActivity(t *testing.T) {
wantErr: fmt.Sprintf("activity error (type: download-activity, scheduledEventID: 0, startedEventID: 0, identity: ): download blob: error loading watcher: unknown watcher %s", watcherName),
},
} {
tt := tt
t.Run(tt.name, func(t *testing.T) {
t.Parallel()

Expand Down
1 change: 0 additions & 1 deletion internal/workflow/activities/zip_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,6 @@ func TestZipActivity(t *testing.T) {
wantErr: fmt.Sprintf("ZipActivity: create: open %s: permission denied", restrictedDir.Join(transferName+".zip")),
},
} {
tc := tc
t.Run(tc.name, func(t *testing.T) {
t.Parallel()

Expand Down

0 comments on commit 0c1b843

Please sign in to comment.