WARNING: THIS SITE IS A MIRROR OF GITHUB.COM / IT CANNOT LOGIN OR REGISTER ACCOUNTS / THE CONTENTS ARE PROVIDED AS-IS / THIS SITE ASSUMES NO RESPONSIBILITY FOR ANY DISPLAYED CONTENT OR LINKS / IF YOU FOUND SOMETHING MAY NOT GOOD FOR EVERYONE, CONTACT ADMIN AT ilovescratch@foxmail.com
Skip to content

Commit 840220b

Browse files
authored
refactor: omit unnecessary reassignment (#5999)
Signed-off-by: rifeplight <[email protected]>
1 parent c29cc29 commit 840220b

File tree

78 files changed

+0
-171
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

78 files changed

+0
-171
lines changed

cmd/cli/app/auth/auth_test.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,6 @@ func TestCobraMain(t *testing.T) {
2929
}
3030

3131
for _, test := range tests {
32-
test := test
3332

3433
t.Run(test.name, func(t *testing.T) {
3534
t.Parallel()

cmd/cli/app/provider/provider_update_test.go

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,6 @@ func (s *UnitTestSuite) TestParseConfigAttribute() {
6666
}
6767

6868
for _, tt := range tests {
69-
tt := tt
7069

7170
t.Run(tt.name, func(t *testing.T) {
7271
t.Parallel()
@@ -151,7 +150,6 @@ func (s *UnitTestSuite) TestByJSONName() {
151150
}
152151

153152
for _, tt := range tests {
154-
tt := tt
155153

156154
t.Run(tt.name, func(t *testing.T) {
157155
t.Parallel()
@@ -254,7 +252,6 @@ func (s *UnitTestSuite) TestGetField() {
254252
}
255253

256254
for _, tt := range tests {
257-
tt := tt
258255

259256
t.Run(tt.name, func(t *testing.T) {
260257
t.Parallel()
@@ -351,7 +348,6 @@ func (s *UnitTestSuite) TestInitField() {
351348
}
352349

353350
for _, tt := range tests {
354-
tt := tt
355351

356352
t.Run(tt.name, func(t *testing.T) {
357353
t.Parallel()
@@ -499,7 +495,6 @@ func (s *UnitTestSuite) TestConfigAttribute() {
499495
}
500496

501497
for _, tt := range tests {
502-
tt := tt
503498

504499
t.Run(tt.name, func(t *testing.T) {
505500
t.Parallel()

cmd/cli/main_test.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,6 @@ func TestCobraMain(t *testing.T) {
5252
}
5353

5454
for _, test := range tests {
55-
test := test
5655
t.Run(test.name, func(t *testing.T) {
5756
t.Parallel()
5857

cmd/server/main_test.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,6 @@ func TestCobraMain(t *testing.T) {
5252
}
5353

5454
for _, test := range tests {
55-
test := test
5655

5756
t.Run(test.name, func(t *testing.T) {
5857
t.Parallel()

internal/api/api_test.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,6 @@ func TestProtoValidationInterceptor(t *testing.T) {
6969
interceptor := ProtoValidationInterceptor(validator)
7070

7171
for _, tt := range tests {
72-
tt := tt
7372

7473
t.Run(tt.name, func(t *testing.T) {
7574
t.Parallel()

internal/controlplane/common_test.go

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,6 @@ func TestGetRemediationURLFromMetadata(t *testing.T) {
2626
{"no-slug-no-pr", []byte(`{}`), "", "", true},
2727
{"invalid-json", []byte(`Yo!`), "", "", true},
2828
} {
29-
tc := tc
3029
t.Run(tc.name, func(t *testing.T) {
3130
t.Parallel()
3231
url, err := getRemediationURLFromMetadata(tc.data, tc.repo)
@@ -58,7 +57,6 @@ func TestGetAlertURLFromMetadata(t *testing.T) {
5857
{"no-advisory", []byte(`{"ghsa_id": ""}`), "", "", true},
5958
{"invalid-slug", []byte(`{"ghsa_id": "abc"}`), "invalid slug", "", true},
6059
} {
61-
tc := tc
6260
t.Run(tc.name, func(t *testing.T) {
6361
t.Parallel()
6462
res, err := getAlertURLFromMetadata(tc.data, tc.repo)

internal/controlplane/handlers_datasource_test.go

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,6 @@ func TestCreateDataSource(t *testing.T) {
5555
}
5656

5757
for _, tt := range tests {
58-
tt := tt // capture range variable
5958
t.Run(tt.name, func(t *testing.T) {
6059
t.Parallel()
6160
ctrl := gomock.NewController(t)
@@ -151,7 +150,6 @@ func TestGetDataSourceById(t *testing.T) {
151150
}
152151

153152
for _, tt := range tests {
154-
tt := tt // capture range variable
155153
t.Run(tt.name, func(t *testing.T) {
156154
t.Parallel()
157155
ctrl := gomock.NewController(t)
@@ -230,7 +228,6 @@ func TestGetDataSourceByName(t *testing.T) {
230228
}
231229

232230
for _, tt := range tests {
233-
tt := tt // capture range variable
234231
t.Run(tt.name, func(t *testing.T) {
235232
t.Parallel()
236233
ctrl := gomock.NewController(t)
@@ -299,7 +296,6 @@ func TestListDataSources(t *testing.T) {
299296
}
300297

301298
for _, tt := range tests {
302-
tt := tt // capture range variable
303299
t.Run(tt.name, func(t *testing.T) {
304300
t.Parallel()
305301
ctrl := gomock.NewController(t)
@@ -373,7 +369,6 @@ func TestUpdateDataSource(t *testing.T) {
373369
}
374370

375371
for _, tt := range tests {
376-
tt := tt // capture range variable
377372
t.Run(tt.name, func(t *testing.T) {
378373
t.Parallel()
379374
ctrl := gomock.NewController(t)
@@ -463,7 +458,6 @@ func TestDeleteDataSourceById(t *testing.T) {
463458
}
464459

465460
for _, tt := range tests {
466-
tt := tt // capture range variable
467461
t.Run(tt.name, func(t *testing.T) {
468462
t.Parallel()
469463
ctrl := gomock.NewController(t)
@@ -560,7 +554,6 @@ func TestDeleteDataSourceByName(t *testing.T) {
560554
}
561555

562556
for _, tt := range tests {
563-
tt := tt // capture range variable
564557
t.Run(tt.name, func(t *testing.T) {
565558
t.Parallel()
566559
ctrl := gomock.NewController(t)

internal/controlplane/handlers_evalstatus.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -368,7 +368,6 @@ func (s *Server) sortEntitiesEvaluationStatus(
368368
}
369369

370370
for _, p := range profileList {
371-
p := p
372371
evals, err := store.ListRuleEvaluationsByProfileId(
373372
ctx, db.ListRuleEvaluationsByProfileIdParams{ProfileID: p.Profile.ID},
374373
)

internal/controlplane/handlers_evalstatus_test.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,6 @@ func TestBuildEvalResultAlertFromLRERow(t *testing.T) {
8787
},
8888
},
8989
} {
90-
tc := tc
9190
t.Run(tc.name, func(t *testing.T) {
9291
t.Parallel()
9392
res := buildEvalResultAlertFromLRERow(tc.sut, tc.efp)

internal/controlplane/handlers_profile_test.go

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -287,7 +287,6 @@ func TestCreateProfile(t *testing.T) {
287287
}
288288

289289
for _, tc := range tests {
290-
tc := tc
291290

292291
t.Run(tc.name, func(t *testing.T) {
293292
t.Parallel()
@@ -1011,7 +1010,6 @@ func TestPatchProfile(t *testing.T) {
10111010
}
10121011

10131012
for _, tc := range tests {
1014-
tc := tc
10151013

10161014
t.Run(tc.name, func(t *testing.T) {
10171015
t.Parallel()
@@ -1371,7 +1369,6 @@ func TestDeleteProfile(t *testing.T) {
13711369
}
13721370

13731371
for _, tc := range tests {
1374-
tc := tc
13751372
t.Run(tc.name, func(t *testing.T) {
13761373
t.Parallel()
13771374

@@ -1486,7 +1483,6 @@ func TestListProfiles(t *testing.T) {
14861483
}
14871484

14881485
for _, tc := range tests {
1489-
tc := tc
14901486

14911487
t.Run(tc.name, func(t *testing.T) {
14921488
t.Parallel()
@@ -1602,7 +1598,6 @@ func TestGetProfileById(t *testing.T) {
16021598
}
16031599

16041600
for _, tc := range tests {
1605-
tc := tc
16061601

16071602
t.Run(tc.name, func(t *testing.T) {
16081603
t.Parallel()
@@ -1707,7 +1702,6 @@ func TestGetProfileByName(t *testing.T) {
17071702
}
17081703

17091704
for _, tc := range tests {
1710-
tc := tc
17111705

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

0 commit comments

Comments
 (0)