Skip to content

Commit e0fa613

Browse files
authored
Update golangci config and resolve copyloopvar (#265)
1 parent e0dda54 commit e0fa613

File tree

151 files changed

+99
-195
lines changed

Some content is hidden

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

151 files changed

+99
-195
lines changed

.golangci.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ linters:
77
enable:
88
- durationcheck
99
- errcheck
10-
- exportloopref
10+
- copyloopvar
1111
- forcetypeassert
1212
- gofmt
1313
- gosimple
@@ -18,7 +18,7 @@ linters:
1818
- paralleltest
1919
- predeclared
2020
- staticcheck
21-
- tenv
21+
- usetesting
2222
- unconvert
2323
- unparam
2424
- unused

boolvalidator/equals_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,11 @@ import (
88
"fmt"
99
"testing"
1010

11-
"github.com/hashicorp/terraform-plugin-framework-validators/boolvalidator"
1211
"github.com/hashicorp/terraform-plugin-framework/function"
1312
"github.com/hashicorp/terraform-plugin-framework/schema/validator"
1413
"github.com/hashicorp/terraform-plugin-framework/types"
14+
15+
"github.com/hashicorp/terraform-plugin-framework-validators/boolvalidator"
1516
)
1617

1718
func TestEqualsValidator(t *testing.T) {
@@ -44,7 +45,6 @@ func TestEqualsValidator(t *testing.T) {
4445
}
4546

4647
for name, test := range testCases {
47-
name, test := name, test
4848

4949
t.Run(fmt.Sprintf("ValidateBool - %s", name), func(t *testing.T) {
5050
t.Parallel()

datasourcevalidator/all_test.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -161,7 +161,6 @@ func TestAllValidatorValidateDataSource(t *testing.T) {
161161
}
162162

163163
for name, testCase := range testCases {
164-
name, testCase := name, testCase
165164

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

datasourcevalidator/any_test.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -138,7 +138,6 @@ func TestAnyValidatorValidateDataSource(t *testing.T) {
138138
}
139139

140140
for name, testCase := range testCases {
141-
name, testCase := name, testCase
142141

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

datasourcevalidator/any_with_all_warnings_test.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -199,7 +199,6 @@ func TestAnyWithAllWarningsValidatorValidateDataSource(t *testing.T) {
199199
}
200200

201201
for name, testCase := range testCases {
202-
name, testCase := name, testCase
203202

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

datasourcevalidator/at_least_one_of_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,13 +8,14 @@ import (
88
"testing"
99

1010
"github.com/google/go-cmp/cmp"
11-
"github.com/hashicorp/terraform-plugin-framework-validators/datasourcevalidator"
1211
"github.com/hashicorp/terraform-plugin-framework/datasource"
1312
"github.com/hashicorp/terraform-plugin-framework/datasource/schema"
1413
"github.com/hashicorp/terraform-plugin-framework/diag"
1514
"github.com/hashicorp/terraform-plugin-framework/path"
1615
"github.com/hashicorp/terraform-plugin-framework/tfsdk"
1716
"github.com/hashicorp/terraform-plugin-go/tftypes"
17+
18+
"github.com/hashicorp/terraform-plugin-framework-validators/datasourcevalidator"
1819
)
1920

2021
func TestAtLeastOneOf(t *testing.T) {
@@ -105,7 +106,6 @@ func TestAtLeastOneOf(t *testing.T) {
105106
}
106107

107108
for name, testCase := range testCases {
108-
name, testCase := name, testCase
109109

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

datasourcevalidator/conflicting_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,13 +8,14 @@ import (
88
"testing"
99

1010
"github.com/google/go-cmp/cmp"
11-
"github.com/hashicorp/terraform-plugin-framework-validators/datasourcevalidator"
1211
"github.com/hashicorp/terraform-plugin-framework/datasource"
1312
"github.com/hashicorp/terraform-plugin-framework/datasource/schema"
1413
"github.com/hashicorp/terraform-plugin-framework/diag"
1514
"github.com/hashicorp/terraform-plugin-framework/path"
1615
"github.com/hashicorp/terraform-plugin-framework/tfsdk"
1716
"github.com/hashicorp/terraform-plugin-go/tftypes"
17+
18+
"github.com/hashicorp/terraform-plugin-framework-validators/datasourcevalidator"
1819
)
1920

2021
func TestConflicting(t *testing.T) {
@@ -106,7 +107,6 @@ func TestConflicting(t *testing.T) {
106107
}
107108

108109
for name, testCase := range testCases {
109-
name, testCase := name, testCase
110110

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

datasourcevalidator/exactly_one_of_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,13 +8,14 @@ import (
88
"testing"
99

1010
"github.com/google/go-cmp/cmp"
11-
"github.com/hashicorp/terraform-plugin-framework-validators/datasourcevalidator"
1211
"github.com/hashicorp/terraform-plugin-framework/datasource"
1312
"github.com/hashicorp/terraform-plugin-framework/datasource/schema"
1413
"github.com/hashicorp/terraform-plugin-framework/diag"
1514
"github.com/hashicorp/terraform-plugin-framework/path"
1615
"github.com/hashicorp/terraform-plugin-framework/tfsdk"
1716
"github.com/hashicorp/terraform-plugin-go/tftypes"
17+
18+
"github.com/hashicorp/terraform-plugin-framework-validators/datasourcevalidator"
1819
)
1920

2021
func TestExactlyOneOf(t *testing.T) {
@@ -106,7 +107,6 @@ func TestExactlyOneOf(t *testing.T) {
106107
}
107108

108109
for name, testCase := range testCases {
109-
name, testCase := name, testCase
110110

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

datasourcevalidator/required_together_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,13 +8,14 @@ import (
88
"testing"
99

1010
"github.com/google/go-cmp/cmp"
11-
"github.com/hashicorp/terraform-plugin-framework-validators/datasourcevalidator"
1211
"github.com/hashicorp/terraform-plugin-framework/datasource"
1312
"github.com/hashicorp/terraform-plugin-framework/datasource/schema"
1413
"github.com/hashicorp/terraform-plugin-framework/diag"
1514
"github.com/hashicorp/terraform-plugin-framework/path"
1615
"github.com/hashicorp/terraform-plugin-framework/tfsdk"
1716
"github.com/hashicorp/terraform-plugin-go/tftypes"
17+
18+
"github.com/hashicorp/terraform-plugin-framework-validators/datasourcevalidator"
1819
)
1920

2021
func TestRequiredTogether(t *testing.T) {
@@ -106,7 +107,6 @@ func TestRequiredTogether(t *testing.T) {
106107
}
107108

108109
for name, testCase := range testCases {
109-
name, testCase := name, testCase
110110

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

ephemeralvalidator/all_test.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -161,7 +161,6 @@ func TestAllValidatorValidateEphemeralResource(t *testing.T) {
161161
}
162162

163163
for name, testCase := range testCases {
164-
name, testCase := name, testCase
165164

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

ephemeralvalidator/any_test.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -138,7 +138,6 @@ func TestAnyValidatorValidateEphemeralResource(t *testing.T) {
138138
}
139139

140140
for name, testCase := range testCases {
141-
name, testCase := name, testCase
142141

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

ephemeralvalidator/any_with_all_warnings_test.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -199,7 +199,6 @@ func TestAnyWithAllWarningsValidatorValidateEphemeralResource(t *testing.T) {
199199
}
200200

201201
for name, testCase := range testCases {
202-
name, testCase := name, testCase
203202

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

ephemeralvalidator/at_least_one_of_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,13 +8,14 @@ import (
88
"testing"
99

1010
"github.com/google/go-cmp/cmp"
11-
"github.com/hashicorp/terraform-plugin-framework-validators/ephemeralvalidator"
1211
"github.com/hashicorp/terraform-plugin-framework/diag"
1312
"github.com/hashicorp/terraform-plugin-framework/ephemeral"
1413
"github.com/hashicorp/terraform-plugin-framework/ephemeral/schema"
1514
"github.com/hashicorp/terraform-plugin-framework/path"
1615
"github.com/hashicorp/terraform-plugin-framework/tfsdk"
1716
"github.com/hashicorp/terraform-plugin-go/tftypes"
17+
18+
"github.com/hashicorp/terraform-plugin-framework-validators/ephemeralvalidator"
1819
)
1920

2021
func TestAtLeastOneOf(t *testing.T) {
@@ -105,7 +106,6 @@ func TestAtLeastOneOf(t *testing.T) {
105106
}
106107

107108
for name, testCase := range testCases {
108-
name, testCase := name, testCase
109109

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

ephemeralvalidator/conflicting_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,13 +8,14 @@ import (
88
"testing"
99

1010
"github.com/google/go-cmp/cmp"
11-
"github.com/hashicorp/terraform-plugin-framework-validators/ephemeralvalidator"
1211
"github.com/hashicorp/terraform-plugin-framework/diag"
1312
"github.com/hashicorp/terraform-plugin-framework/ephemeral"
1413
"github.com/hashicorp/terraform-plugin-framework/ephemeral/schema"
1514
"github.com/hashicorp/terraform-plugin-framework/path"
1615
"github.com/hashicorp/terraform-plugin-framework/tfsdk"
1716
"github.com/hashicorp/terraform-plugin-go/tftypes"
17+
18+
"github.com/hashicorp/terraform-plugin-framework-validators/ephemeralvalidator"
1819
)
1920

2021
func TestConflicting(t *testing.T) {
@@ -106,7 +107,6 @@ func TestConflicting(t *testing.T) {
106107
}
107108

108109
for name, testCase := range testCases {
109-
name, testCase := name, testCase
110110

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

ephemeralvalidator/exactly_one_of_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,13 +8,14 @@ import (
88
"testing"
99

1010
"github.com/google/go-cmp/cmp"
11-
"github.com/hashicorp/terraform-plugin-framework-validators/ephemeralvalidator"
1211
"github.com/hashicorp/terraform-plugin-framework/diag"
1312
"github.com/hashicorp/terraform-plugin-framework/ephemeral"
1413
"github.com/hashicorp/terraform-plugin-framework/ephemeral/schema"
1514
"github.com/hashicorp/terraform-plugin-framework/path"
1615
"github.com/hashicorp/terraform-plugin-framework/tfsdk"
1716
"github.com/hashicorp/terraform-plugin-go/tftypes"
17+
18+
"github.com/hashicorp/terraform-plugin-framework-validators/ephemeralvalidator"
1819
)
1920

2021
func TestExactlyOneOf(t *testing.T) {
@@ -106,7 +107,6 @@ func TestExactlyOneOf(t *testing.T) {
106107
}
107108

108109
for name, testCase := range testCases {
109-
name, testCase := name, testCase
110110

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

ephemeralvalidator/required_together_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,13 +8,14 @@ import (
88
"testing"
99

1010
"github.com/google/go-cmp/cmp"
11-
"github.com/hashicorp/terraform-plugin-framework-validators/ephemeralvalidator"
1211
"github.com/hashicorp/terraform-plugin-framework/diag"
1312
"github.com/hashicorp/terraform-plugin-framework/ephemeral"
1413
"github.com/hashicorp/terraform-plugin-framework/ephemeral/schema"
1514
"github.com/hashicorp/terraform-plugin-framework/path"
1615
"github.com/hashicorp/terraform-plugin-framework/tfsdk"
1716
"github.com/hashicorp/terraform-plugin-go/tftypes"
17+
18+
"github.com/hashicorp/terraform-plugin-framework-validators/ephemeralvalidator"
1819
)
1920

2021
func TestRequiredTogether(t *testing.T) {
@@ -106,7 +107,6 @@ func TestRequiredTogether(t *testing.T) {
106107
}
107108

108109
for name, testCase := range testCases {
109-
name, testCase := name, testCase
110110

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

float32validator/all_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ func TestAllValidatorValidateFloat32(t *testing.T) {
5555
}
5656

5757
for name, test := range tests {
58-
name, test := name, test
58+
5959
t.Run(name, func(t *testing.T) {
6060
t.Parallel()
6161
request := validator.Float32Request{

float32validator/any_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ func TestAnyValidatorValidateFloat32(t *testing.T) {
6666
}
6767

6868
for name, test := range tests {
69-
name, test := name, test
69+
7070
t.Run(name, func(t *testing.T) {
7171
t.Parallel()
7272
request := validator.Float32Request{

float32validator/any_with_all_warnings_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ func TestAnyWithAllWarningsValidatorValidateFloat32(t *testing.T) {
6767
}
6868

6969
for name, test := range tests {
70-
name, test := name, test
70+
7171
t.Run(name, func(t *testing.T) {
7272
t.Parallel()
7373
request := validator.Float32Request{

float32validator/at_least_test.go

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

5555
for name, test := range tests {
56-
name, test := name, test
5756

5857
t.Run(fmt.Sprintf("ValidateFloat32 - %s", name), func(t *testing.T) {
5958
t.Parallel()

float32validator/at_most_test.go

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

5555
for name, test := range tests {
56-
name, test := name, test
5756

5857
t.Run(fmt.Sprintf("ValidateFloat32 - %s", name), func(t *testing.T) {
5958
t.Parallel()

float32validator/between_test.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,6 @@ func TestBetweenValidator(t *testing.T) {
7777
}
7878

7979
for name, test := range tests {
80-
name, test := name, test
8180

8281
t.Run(fmt.Sprintf("ValidateFloat32 - %s", name), func(t *testing.T) {
8382
t.Parallel()

float32validator/none_of_test.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,6 @@ func TestNoneOfValidator(t *testing.T) {
6262
}
6363

6464
for name, test := range testCases {
65-
name, test := name, test
6665

6766
t.Run(fmt.Sprintf("ValidateFloat32 - %s", name), func(t *testing.T) {
6867
t.Parallel()

float32validator/one_of_test.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,6 @@ func TestOneOfValidator(t *testing.T) {
6262
}
6363

6464
for name, test := range testCases {
65-
name, test := name, test
6665

6766
t.Run(fmt.Sprintf("ValidateFloat32 - %s", name), func(t *testing.T) {
6867
t.Parallel()

float64validator/all_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ func TestAllValidatorValidateFloat64(t *testing.T) {
5555
}
5656

5757
for name, test := range tests {
58-
name, test := name, test
58+
5959
t.Run(name, func(t *testing.T) {
6060
t.Parallel()
6161
request := validator.Float64Request{

float64validator/any_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ func TestAnyValidatorValidateFloat64(t *testing.T) {
6666
}
6767

6868
for name, test := range tests {
69-
name, test := name, test
69+
7070
t.Run(name, func(t *testing.T) {
7171
t.Parallel()
7272
request := validator.Float64Request{

float64validator/any_with_all_warnings_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ func TestAnyWithAllWarningsValidatorValidateFloat64(t *testing.T) {
6767
}
6868

6969
for name, test := range tests {
70-
name, test := name, test
70+
7171
t.Run(name, func(t *testing.T) {
7272
t.Parallel()
7373
request := validator.Float64Request{

float64validator/at_least_test.go

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

5555
for name, test := range tests {
56-
name, test := name, test
5756

5857
t.Run(fmt.Sprintf("ValidateFloat64 - %s", name), func(t *testing.T) {
5958
t.Parallel()

float64validator/at_most_test.go

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

5555
for name, test := range tests {
56-
name, test := name, test
5756

5857
t.Run(fmt.Sprintf("ValidateFloat64 - %s", name), func(t *testing.T) {
5958
t.Parallel()

0 commit comments

Comments
 (0)