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()

0 commit comments

Comments
 (0)