@@ -228,8 +228,6 @@ func TestSubjectSetAdd(t *testing.T) {
228228 }
229229
230230 for _ , tc := range tcs {
231- tc := tc
232-
233231 t .Run (tc .name , func (t * testing.T ) {
234232 existingSet := NewSubjectSet ()
235233 for _ , existing := range tc .existing {
@@ -597,8 +595,6 @@ func TestSubjectSetSubtract(t *testing.T) {
597595 }
598596
599597 for _ , tc := range tcs {
600- tc := tc
601-
602598 t .Run (tc .name , func (t * testing.T ) {
603599 existingSet := NewSubjectSet ()
604600 for _ , existing := range tc .existing {
@@ -933,8 +929,6 @@ func TestSubjectSetIntersection(t *testing.T) {
933929 }
934930
935931 for _ , tc := range tcs {
936- tc := tc
937-
938932 t .Run (tc .name , func (t * testing.T ) {
939933 existingSet := NewSubjectSet ()
940934 for _ , existing := range tc .existing {
@@ -1308,8 +1302,6 @@ func TestMultipleOperations(t *testing.T) {
13081302 }
13091303
13101304 for _ , tc := range tcs {
1311- tc := tc
1312-
13131305 t .Run (tc .name , func (t * testing.T ) {
13141306 set := NewSubjectSet ()
13151307 tc .runOps (set )
@@ -1355,8 +1347,6 @@ func TestSubtractAll(t *testing.T) {
13551347 }
13561348
13571349 for _ , tc := range tcs {
1358- tc := tc
1359-
13601350 t .Run (tc .name , func (t * testing.T ) {
13611351 set := NewSubjectSet ()
13621352
@@ -1464,7 +1454,6 @@ var testSets = [][]*v1.FoundSubject{
14641454
14651455func TestUnionCommutativity (t * testing.T ) {
14661456 for _ , pair := range allSubsets (testSets , 2 ) {
1467- pair := pair
14681457 t .Run (fmt .Sprintf ("%v" , pair ), func (t * testing.T ) {
14691458 left1 , left2 := NewSubjectSet (), NewSubjectSet ()
14701459 for _ , l := range pair [0 ] {
@@ -1491,7 +1480,6 @@ func TestUnionCommutativity(t *testing.T) {
14911480
14921481func TestUnionAssociativity (t * testing.T ) {
14931482 for _ , triple := range allSubsets (testSets , 3 ) {
1494- triple := triple
14951483 t .Run (fmt .Sprintf ("%s U %s U %s" , testutil .FormatSubjects (triple [0 ]), testutil .FormatSubjects (triple [1 ]), testutil .FormatSubjects (triple [2 ])), func (t * testing.T ) {
14961484 // A U (B U C) == (A U B) U C
14971485
@@ -1528,7 +1516,6 @@ func TestUnionAssociativity(t *testing.T) {
15281516
15291517func TestIntersectionCommutativity (t * testing.T ) {
15301518 for _ , pair := range allSubsets (testSets , 2 ) {
1531- pair := pair
15321519 t .Run (fmt .Sprintf ("%v" , pair ), func (t * testing.T ) {
15331520 left1 , left2 := NewSubjectSet (), NewSubjectSet ()
15341521 for _ , l := range pair [0 ] {
@@ -1554,7 +1541,6 @@ func TestIntersectionCommutativity(t *testing.T) {
15541541
15551542func TestIntersectionAssociativity (t * testing.T ) {
15561543 for _ , triple := range allSubsets (testSets , 3 ) {
1557- triple := triple
15581544 t .Run (fmt .Sprintf ("%s ∩ %s ∩ %s" , testutil .FormatSubjects (triple [0 ]), testutil .FormatSubjects (triple [1 ]), testutil .FormatSubjects (triple [2 ])), func (t * testing.T ) {
15591545 // A ∩ (B ∩ C) == (A ∩ B) ∩ C
15601546
@@ -1591,7 +1577,6 @@ func TestIntersectionAssociativity(t *testing.T) {
15911577
15921578func TestIdempotentUnion (t * testing.T ) {
15931579 for _ , set := range testSets {
1594- set := set
15951580 t .Run (fmt .Sprintf ("%v" , set ), func (t * testing.T ) {
15961581 // A U A == A
15971582 A1 , A2 := NewSubjectSet (), NewSubjectSet ()
@@ -1610,7 +1595,6 @@ func TestIdempotentUnion(t *testing.T) {
16101595
16111596func TestIdempotentIntersection (t * testing.T ) {
16121597 for _ , set := range testSets {
1613- set := set
16141598 t .Run (fmt .Sprintf ("%v" , set ), func (t * testing.T ) {
16151599 // A ∩ A == A
16161600 A1 , A2 := NewSubjectSet (), NewSubjectSet ()
@@ -1725,8 +1709,6 @@ func TestUnionWildcardWithWildcard(t *testing.T) {
17251709 }
17261710
17271711 for _ , tc := range tcs {
1728- tc := tc
1729-
17301712 t .Run (fmt .Sprintf ("%s U %s" , testutil .FormatSubject (tc .existing ), testutil .FormatSubject (tc .toUnion )), func (t * testing.T ) {
17311713 existing := wrap (tc .existing )
17321714 produced , err := unionWildcardWithWildcard (existing , tc .toUnion , subjectSetConstructor )
@@ -1845,8 +1827,6 @@ func TestUnionWildcardWithConcrete(t *testing.T) {
18451827 }
18461828
18471829 for _ , tc := range tcs {
1848- tc := tc
1849-
18501830 t .Run (fmt .Sprintf ("%s U %s" , testutil .FormatSubject (tc .existing ), testutil .FormatSubject (tc .toUnion )), func (t * testing.T ) {
18511831 existing := wrap (tc .existing )
18521832 produced := unionWildcardWithConcrete (existing , tc .toUnion , subjectSetConstructor )
@@ -1905,8 +1885,6 @@ func TestUnionConcreteWithConcrete(t *testing.T) {
19051885 }
19061886
19071887 for _ , tc := range tcs {
1908- tc := tc
1909-
19101888 t .Run (fmt .Sprintf ("%s U %s" , testutil .FormatSubject (tc .existing ), testutil .FormatSubject (tc .toUnion )), func (t * testing.T ) {
19111889 existing := wrap (tc .existing )
19121890 toUnion := wrap (tc .toUnion )
@@ -2048,8 +2026,6 @@ func TestSubtractWildcardFromWildcard(t *testing.T) {
20482026 }
20492027
20502028 for _ , tc := range tcs {
2051- tc := tc
2052-
20532029 t .Run (fmt .Sprintf ("%s - %s" , testutil .FormatSubject (tc .existing ), testutil .FormatSubject (tc .toSubtract )), func (t * testing.T ) {
20542030 existing := wrap (tc .existing )
20552031
@@ -2157,8 +2133,6 @@ func TestSubtractWildcardFromConcrete(t *testing.T) {
21572133 }
21582134
21592135 for _ , tc := range tcs {
2160- tc := tc
2161-
21622136 t .Run (fmt .Sprintf ("%v - %v" , testutil .FormatSubject (tc .existing ), testutil .FormatSubject (tc .toSubtract )), func (t * testing.T ) {
21632137 produced := subtractWildcardFromConcrete (tc .existing , tc .toSubtract , subjectSetConstructor )
21642138 testutil .RequireExpectedSubject (t , tc .expected , produced )
@@ -2208,8 +2182,6 @@ func TestSubtractConcreteFromConcrete(t *testing.T) {
22082182 }
22092183
22102184 for _ , tc := range tcs {
2211- tc := tc
2212-
22132185 t .Run (fmt .Sprintf ("%s - %s" , testutil .FormatSubject (tc .existing ), testutil .FormatSubject (tc .toSubtract )), func (t * testing.T ) {
22142186 produced := subtractConcreteFromConcrete (tc .existing , tc .toSubtract , subjectSetConstructor )
22152187 testutil .RequireExpectedSubject (t , tc .expected , produced )
@@ -2283,8 +2255,6 @@ func TestSubtractConcreteFromWildcard(t *testing.T) {
22832255 }
22842256
22852257 for _ , tc := range tcs {
2286- tc := tc
2287-
22882258 t .Run (fmt .Sprintf ("%s - %s" , testutil .FormatSubject (tc .existing ), testutil .FormatSubject (tc .toSubtract )), func (t * testing.T ) {
22892259 produced := subtractConcreteFromWildcard (tc .existing , tc .toSubtract , subjectSetConstructor )
22902260 testutil .RequireExpectedSubject (t , tc .expected , produced )
@@ -2341,8 +2311,6 @@ func TestIntersectConcreteWithConcrete(t *testing.T) {
23412311 }
23422312
23432313 for _ , tc := range tcs {
2344- tc := tc
2345-
23462314 t .Run (fmt .Sprintf ("%s ∩ %s" , testutil .FormatSubject (tc .first ), testutil .FormatSubject (tc .second )), func (t * testing.T ) {
23472315 second := wrap (tc .second )
23482316
@@ -2453,8 +2421,6 @@ func TestIntersectWildcardWithWildcard(t *testing.T) {
24532421 }
24542422
24552423 for _ , tc := range tcs {
2456- tc := tc
2457-
24582424 t .Run (fmt .Sprintf ("%s ∩ %s" , testutil .FormatSubject (tc .first ), testutil .FormatSubject (tc .second )), func (t * testing.T ) {
24592425 first := wrap (tc .first )
24602426 second := wrap (tc .second )
@@ -2582,8 +2548,6 @@ func TestIntersectConcreteWithWildcard(t *testing.T) {
25822548 }
25832549
25842550 for _ , tc := range tcs {
2585- tc := tc
2586-
25872551 t .Run (fmt .Sprintf ("%s ∩ %s" , testutil .FormatSubject (tc .concrete ), testutil .FormatSubject (tc .wildcard )), func (t * testing.T ) {
25882552 wildcard := wrap (tc .wildcard )
25892553
@@ -2601,7 +2565,7 @@ func allSubsets[T any](objs []T, n int) [][]T {
26012565 maxInt := uint64 (math .Exp2 (float64 (len (objs )))) - 1
26022566 all := make ([][]T , 0 )
26032567
2604- for i := uint64 ( 0 ); i < maxInt ; i ++ {
2568+ for i := range maxInt {
26052569 set := make ([]T , 0 , n )
26062570 for digit := uint64 (0 ); digit < uint64 (len (objs )); digit ++ {
26072571 mask := uint64 (1 ) << digit
0 commit comments