Skip to content

Commit

Permalink
refactor: fix copyloopvar, dupword lint issues (#3387)
Browse files Browse the repository at this point in the history
  • Loading branch information
alexandear authored Nov 24, 2024
1 parent 8a5f927 commit 0d5b25e
Show file tree
Hide file tree
Showing 8 changed files with 7 additions and 7 deletions.
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

0 comments on commit 0d5b25e

Please sign in to comment.