Skip to content

Commit 0d5b25e

Browse files
authored
refactor: fix copyloopvar, dupword lint issues (#3387)
1 parent 8a5f927 commit 0d5b25e

File tree

8 files changed

+7
-7
lines changed

8 files changed

+7
-7
lines changed

‎.golangci.yml‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,9 @@ linters:
7474
disable-all: true
7575
enable:
7676
- bodyclose
77+
- copyloopvar
7778
- dupl
79+
- dupword
7880
- errcheck
7981
- gocritic
8082
- gofmt

‎_examples/federation/subgraphs/subgraphs.go‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,6 @@ func (s *Subgraphs) Shutdown(ctx context.Context) error {
4141
func (s *Subgraphs) ListenAndServe(ctx context.Context) error {
4242
group, _ := errgroup.WithContext(ctx)
4343
for _, srv := range s.servers {
44-
srv := srv
4544
group.Go(func() error {
4645
err := srv.ListenAndServe()
4746
if err != nil && !errors.Is(err, http.ErrServerClosed) {

‎codegen/testserver/followschema/directive_test.go‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ func isNil(input any) bool {
2020
return true
2121
}
2222
// Using reflect to check if the value is nil. This is necessary for
23-
// for any types that are not nil types but have a nil value (e.g. *string).
23+
// any types that are not nil types but have a nil value (e.g. *string).
2424
value := reflect.ValueOf(input)
2525
return value.IsNil()
2626
}

‎codegen/testserver/nullabledirectives/directive_test.go‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ func isNil(input any) bool {
2121
return true
2222
}
2323
// Using reflect to check if the value is nil. This is necessary for
24-
// for any types that are not nil types but have a nil value (e.g. *string).
24+
// any types that are not nil types but have a nil value (e.g. *string).
2525
value := reflect.ValueOf(input)
2626
return value.IsNil()
2727
}

‎codegen/testserver/singlefile/directive_test.go‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ func isNil(input any) bool {
2020
return true
2121
}
2222
// Using reflect to check if the value is nil. This is necessary for
23-
// for any types that are not nil types but have a nil value (e.g. *string).
23+
// any types that are not nil types but have a nil value (e.g. *string).
2424
value := reflect.ValueOf(input)
2525
return value.IsNil()
2626
}

‎graphql/context_operation_test.go‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -169,7 +169,7 @@ func TestCollectFields(t *testing.T) {
169169
require.Equal(t, []string{"fieldA", "fieldB", "fieldC"}, getNames(collected))
170170
})
171171

172-
t.Run("handles inline fragments with with include and skip", func(t *testing.T) {
172+
t.Run("handles inline fragments with include and skip", func(t *testing.T) {
173173
ctx := testContext(ast.SelectionSet{
174174
&ast.InlineFragment{
175175
TypeCondition: "",

‎graphql/omittable_test.go‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ func TestOmittable_MarshalJSON(t *testing.T) {
3131
expectedJSON: `{"Value": null}`,
3232
},
3333
{
34-
name: "omittable omittable",
34+
name: "omittable omittable", //nolint:dupword
3535
input: struct{ Value Omittable[Omittable[uint64]] }{Value: OmittableOf(OmittableOf(uint64(42)))},
3636
expectedJSON: `{"Value": 42}`,
3737
},

‎plugin/modelgen/models_test.go‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -200,7 +200,6 @@ func TestModelGeneration(t *testing.T) {
200200
},
201201
}
202202
for _, tc := range cases {
203-
tc := tc
204203
t.Run(tc.name, func(t *testing.T) {
205204
typeSpec, ok := generated.Scope.Lookup(tc.name).Decl.(*ast.TypeSpec)
206205
require.True(t, ok)

0 commit comments

Comments
 (0)