Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor: fix copyloopvar, dupword lint issues #3387

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .golangci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,9 @@ linters:
disable-all: true
enable:
- bodyclose
- copyloopvar
- dupl
- dupword
- errcheck
- gocritic
- gofmt
Expand Down
1 change: 0 additions & 1 deletion _examples/federation/subgraphs/subgraphs.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,6 @@ func (s *Subgraphs) Shutdown(ctx context.Context) error {
func (s *Subgraphs) ListenAndServe(ctx context.Context) error {
group, _ := errgroup.WithContext(ctx)
for _, srv := range s.servers {
srv := srv
group.Go(func() error {
err := srv.ListenAndServe()
if err != nil && !errors.Is(err, http.ErrServerClosed) {
Expand Down
2 changes: 1 addition & 1 deletion codegen/testserver/followschema/directive_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ func isNil(input any) bool {
return true
}
// Using reflect to check if the value is nil. This is necessary for
// for any types that are not nil types but have a nil value (e.g. *string).
// any types that are not nil types but have a nil value (e.g. *string).
value := reflect.ValueOf(input)
return value.IsNil()
}
Expand Down
2 changes: 1 addition & 1 deletion codegen/testserver/nullabledirectives/directive_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ func isNil(input any) bool {
return true
}
// Using reflect to check if the value is nil. This is necessary for
// for any types that are not nil types but have a nil value (e.g. *string).
// any types that are not nil types but have a nil value (e.g. *string).
value := reflect.ValueOf(input)
return value.IsNil()
}
Expand Down
2 changes: 1 addition & 1 deletion codegen/testserver/singlefile/directive_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ func isNil(input any) bool {
return true
}
// Using reflect to check if the value is nil. This is necessary for
// for any types that are not nil types but have a nil value (e.g. *string).
// any types that are not nil types but have a nil value (e.g. *string).
value := reflect.ValueOf(input)
return value.IsNil()
}
Expand Down
2 changes: 1 addition & 1 deletion graphql/context_operation_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,7 @@ func TestCollectFields(t *testing.T) {
require.Equal(t, []string{"fieldA", "fieldB", "fieldC"}, getNames(collected))
})

t.Run("handles inline fragments with with include and skip", func(t *testing.T) {
t.Run("handles inline fragments with include and skip", func(t *testing.T) {
ctx := testContext(ast.SelectionSet{
&ast.InlineFragment{
TypeCondition: "",
Expand Down
2 changes: 1 addition & 1 deletion graphql/omittable_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ func TestOmittable_MarshalJSON(t *testing.T) {
expectedJSON: `{"Value": null}`,
},
{
name: "omittable omittable",
name: "omittable omittable", //nolint:dupword
input: struct{ Value Omittable[Omittable[uint64]] }{Value: OmittableOf(OmittableOf(uint64(42)))},
expectedJSON: `{"Value": 42}`,
},
Expand Down
1 change: 0 additions & 1 deletion plugin/modelgen/models_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -200,7 +200,6 @@ func TestModelGeneration(t *testing.T) {
},
}
for _, tc := range cases {
tc := tc
t.Run(tc.name, func(t *testing.T) {
typeSpec, ok := generated.Scope.Lookup(tc.name).Decl.(*ast.TypeSpec)
require.True(t, ok)
Expand Down
Loading