Skip to content

Commit 34acc9c

Browse files
authored
Remove loopclosure captures from tests (#15202)
Signed-off-by: William Huang <mail.william.huang@gmail.com>
1 parent cd61d85 commit 34acc9c

35 files changed

+0
-256
lines changed

go/flagutil/enum_test.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,6 @@ func TestStringEnum(t *testing.T) {
5656
},
5757
}
5858
for _, tt := range tests {
59-
tt := tt
6059
t.Run(tt.name, func(t *testing.T) {
6160
var enum *StringEnum
6261
if tt.caseInsensitive {

go/protoutil/duration_test.go

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -81,8 +81,6 @@ func TestDurationFromProto(t *testing.T) {
8181
}
8282

8383
for _, tt := range tests {
84-
tt := tt
85-
8684
t.Run(tt.name, func(t *testing.T) {
8785

8886
actual, ok, err := DurationFromProto(tt.in)
@@ -124,8 +122,6 @@ func TestDurationToProto(t *testing.T) {
124122
}
125123

126124
for _, tt := range tests {
127-
tt := tt
128-
129125
t.Run(tt.name, func(t *testing.T) {
130126

131127
actual := DurationToProto(tt.in)

go/vt/callinfo/callinfo_test.go

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

5757
for _, tt := range tests {
58-
tt := tt
5958
t.Run(tt.name, func(t *testing.T) {
6059
require.Equal(t, tt.expectedContext, NewContext(tt.ctx, tt.ci))
6160
})
@@ -84,7 +83,6 @@ func TestFromContext(t *testing.T) {
8483
}
8584

8685
for _, tt := range tests {
87-
tt := tt
8886
t.Run(tt.name, func(t *testing.T) {
8987
ci, ok := FromContext(tt.ctx)
9088
require.Equal(t, tt.expectedCi, ci)
@@ -112,7 +110,6 @@ func TestHTMLFromContext(t *testing.T) {
112110
}
113111

114112
for _, tt := range tests {
115-
tt := tt
116113
t.Run(tt.name, func(t *testing.T) {
117114
require.Equal(t, tt.expectedHTML, HTMLFromContext(tt.ctx))
118115
})

go/vt/logz/logz_utils_test.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,6 @@ func TestWrappable(t *testing.T) {
4545
}
4646

4747
for _, tt := range tests {
48-
tt := tt
4948
t.Run(tt.input, func(t *testing.T) {
5049
require.Equal(t, tt.output, Wrappable(tt.input))
5150
})

go/vt/topo/topotests/cell_info_test.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -217,7 +217,6 @@ func TestExpandCells(t *testing.T) {
217217
}
218218

219219
for _, tt := range tests {
220-
tt := tt
221220
t.Run(tt.name, func(t *testing.T) {
222221
expanded, err := ts.ExpandCells(ctx, tt.in)
223222
if tt.shouldErr {

go/vt/vtadmin/api_test.go

Lines changed: 0 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -547,8 +547,6 @@ func TestFindSchema(t *testing.T) {
547547
ctx := context.Background()
548548

549549
for _, tt := range tests {
550-
tt := tt
551-
552550
t.Run(tt.name, func(t *testing.T) {
553551
t.Parallel()
554552

@@ -862,8 +860,6 @@ func TestGetClusters(t *testing.T) {
862860
ctx := context.Background()
863861

864862
for _, tt := range tests {
865-
tt := tt
866-
867863
t.Run(tt.name, func(t *testing.T) {
868864
t.Parallel()
869865

@@ -1052,8 +1048,6 @@ func TestGetKeyspace(t *testing.T) {
10521048
}
10531049

10541050
for _, tt := range tests {
1055-
tt := tt
1056-
10571051
t.Run(tt.name, func(t *testing.T) {
10581052
t.Parallel()
10591053

@@ -1284,8 +1278,6 @@ func TestGetKeyspaces(t *testing.T) {
12841278
}
12851279

12861280
for _, tt := range tests {
1287-
tt := tt
1288-
12891281
t.Run(tt.name, func(t *testing.T) {
12901282
t.Parallel()
12911283

@@ -1538,8 +1530,6 @@ func TestGetSchema(t *testing.T) {
15381530
}
15391531

15401532
for _, tt := range tests {
1541-
tt := tt
1542-
15431533
t.Run(tt.name, func(t *testing.T) {
15441534
t.Parallel()
15451535
ctx, cancel := context.WithCancel(context.Background())
@@ -2179,8 +2169,6 @@ func TestGetSchemas(t *testing.T) {
21792169
// Note that these test cases were written prior to the existence of
21802170
// WithTestServers, so they are all written with the assumption that
21812171
// there are exactly 2 clusters.
2182-
tt := tt
2183-
21842172
t.Run(tt.name, func(t *testing.T) {
21852173
t.Parallel()
21862174
ctx, cancel := context.WithCancel(context.Background())
@@ -2626,8 +2614,6 @@ func TestGetSrvKeyspace(t *testing.T) {
26262614
}
26272615

26282616
for _, tt := range tests {
2629-
tt := tt
2630-
26312617
t.Run(tt.name, func(t *testing.T) {
26322618
t.Parallel()
26332619

@@ -2787,8 +2773,6 @@ func TestGetSrvKeyspaces(t *testing.T) {
27872773
}
27882774

27892775
for _, tt := range tests {
2790-
tt := tt
2791-
27922776
t.Run(tt.name, func(t *testing.T) {
27932777
t.Parallel()
27942778
ctx, cancel := context.WithCancel(context.Background())
@@ -2956,8 +2940,6 @@ func TestGetSrvVSchema(t *testing.T) {
29562940
}
29572941

29582942
for _, tt := range tests {
2959-
tt := tt
2960-
29612943
t.Run(tt.name, func(t *testing.T) {
29622944
t.Parallel()
29632945
ctx, cancel := context.WithCancel(context.Background())
@@ -3250,8 +3232,6 @@ func TestGetSrvVSchemas(t *testing.T) {
32503232
}
32513233

32523234
for _, tt := range tests {
3253-
tt := tt
3254-
32553235
t.Run(tt.name, func(t *testing.T) {
32563236
t.Parallel()
32573237
ctx, cancel := context.WithCancel(context.Background())
@@ -3531,8 +3511,6 @@ func TestGetTablet(t *testing.T) {
35313511
ctx := context.Background()
35323512

35333513
for _, tt := range tests {
3534-
tt := tt
3535-
35363514
t.Run(tt.name, func(t *testing.T) {
35373515
t.Parallel()
35383516

@@ -3726,8 +3704,6 @@ func TestGetTablets(t *testing.T) {
37263704
ctx := context.Background()
37273705

37283706
for _, tt := range tests {
3729-
tt := tt
3730-
37313707
t.Run(tt.name, func(t *testing.T) {
37323708
t.Parallel()
37333709

@@ -3872,8 +3848,6 @@ func TestGetVSchema(t *testing.T) {
38723848
ctx := context.Background()
38733849

38743850
for _, tt := range tests {
3875-
tt := tt
3876-
38773851
t.Run(tt.name, func(t *testing.T) {
38783852
t.Parallel()
38793853

@@ -4198,8 +4172,6 @@ func TestGetVSchemas(t *testing.T) {
41984172
ctx := context.Background()
41994173

42004174
for _, tt := range tests {
4201-
tt := tt
4202-
42034175
t.Run(tt.name, func(t *testing.T) {
42044176
t.Parallel()
42054177

@@ -4419,8 +4391,6 @@ func TestGetWorkflow(t *testing.T) {
44194391
ctx := context.Background()
44204392

44214393
for _, tt := range tests {
4422-
tt := tt
4423-
44244394
t.Run(tt.name, func(t *testing.T) {
44254395
t.Parallel()
44264396

@@ -4858,8 +4828,6 @@ func TestGetWorkflows(t *testing.T) {
48584828
ctx := context.Background()
48594829

48604830
for _, tt := range tests {
4861-
tt := tt
4862-
48634831
t.Run(tt.name, func(t *testing.T) {
48644832
t.Parallel()
48654833

@@ -5099,8 +5067,6 @@ func TestVTExplain(t *testing.T) {
50995067
}
51005068

51015069
for _, tt := range tests {
5102-
tt := tt
5103-
51045070
t.Run(tt.name, func(t *testing.T) {
51055071
ctx, cancel := context.WithCancel(context.Background())
51065072
defer cancel()
@@ -5350,8 +5316,6 @@ func TestServeHTTP(t *testing.T) {
53505316
}
53515317

53525318
for _, tt := range tests {
5353-
tt := tt
5354-
53555319
t.Run(tt.name, func(t *testing.T) {
53565320
t.Parallel()
53575321

go/vt/vtadmin/cache/cache_test.go

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,6 @@ func TestBackfillDuplicates(t *testing.T) {
6767
}
6868

6969
for _, tt := range tests {
70-
tt := tt
7170
t.Run(tt.name, func(t *testing.T) {
7271
t.Parallel()
7372

@@ -131,7 +130,6 @@ func TestBackfillTTL(t *testing.T) {
131130
}
132131

133132
for _, tt := range tests {
134-
tt := tt
135133
t.Run(tt.name, func(t *testing.T) {
136134
t.Parallel()
137135

go/vt/vtadmin/cache/refresh_test.go

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,6 @@ func TestShouldRefreshFromIncomingContext(t *testing.T) {
6565
}
6666

6767
for _, tt := range tests {
68-
tt := tt
6968
t.Run(tt.name, func(t *testing.T) {
7069
t.Parallel()
7170

@@ -114,7 +113,6 @@ func TestShouldRefreshFromRequest(t *testing.T) {
114113
}
115114

116115
for _, tt := range tests {
117-
tt := tt
118116
t.Run(tt.name, func(t *testing.T) {
119117
t.Parallel()
120118

go/vt/vtadmin/cluster/cluster_internal_test.go

Lines changed: 0 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -142,8 +142,6 @@ func TestDeleteTablets(t *testing.T) {
142142
}
143143

144144
for _, tt := range tests {
145-
tt := tt
146-
147145
t.Run(tt.name, func(t *testing.T) {
148146
t.Parallel()
149147

@@ -331,8 +329,6 @@ func TestEmergencyFailoverShard(t *testing.T) {
331329
}
332330

333331
for _, tt := range tests {
334-
tt := tt
335-
336332
t.Run(tt.name, func(t *testing.T) {
337333
t.Parallel()
338334

@@ -493,8 +489,6 @@ func Test_getShardSets(t *testing.T) {
493489
}
494490

495491
for _, tt := range tests {
496-
tt := tt
497-
498492
t.Run(tt.name, func(t *testing.T) {
499493
t.Parallel()
500494

@@ -662,8 +656,6 @@ func TestPlannedFailoverShard(t *testing.T) {
662656
}
663657

664658
for _, tt := range tests {
665-
tt := tt
666-
667659
t.Run(tt.name, func(t *testing.T) {
668660
t.Parallel()
669661

@@ -775,8 +767,6 @@ func TestRefreshState(t *testing.T) {
775767
}
776768

777769
for _, tt := range tests {
778-
tt := tt
779-
780770
t.Run(tt.name, func(t *testing.T) {
781771
t.Parallel()
782772

@@ -899,8 +889,6 @@ func TestRefreshTabletReplicationSource(t *testing.T) {
899889
}
900890

901891
for _, tt := range tests {
902-
tt := tt
903-
904892
t.Run(tt.name, func(t *testing.T) {
905893
t.Parallel()
906894

@@ -1189,8 +1177,6 @@ func Test_reloadKeyspaceSchemas(t *testing.T) {
11891177
}
11901178

11911179
for _, tt := range tests {
1192-
tt := tt
1193-
11941180
t.Run(tt.name, func(t *testing.T) {
11951181
t.Parallel()
11961182

@@ -1516,8 +1502,6 @@ func Test_reloadShardSchemas(t *testing.T) {
15161502
}
15171503

15181504
for _, tt := range tests {
1519-
tt := tt
1520-
15211505
t.Run(tt.name, func(t *testing.T) {
15221506
t.Parallel()
15231507

@@ -1700,8 +1684,6 @@ func Test_reloadTabletSchemas(t *testing.T) {
17001684
}
17011685

17021686
for _, tt := range tests {
1703-
tt := tt
1704-
17051687
t.Run(tt.name, func(t *testing.T) {
17061688
t.Parallel()
17071689

@@ -1903,8 +1885,6 @@ func TestTabletExternallyPromoted(t *testing.T) {
19031885
}
19041886

19051887
for _, tt := range tests {
1906-
tt := tt
1907-
19081888
t.Run(tt.name, func(t *testing.T) {
19091889
t.Parallel()
19101890

0 commit comments

Comments
 (0)