diff --git a/query/graphql/schema/descriptions.go b/query/graphql/schema/descriptions.go index b27b575354..4b8642fda3 100644 --- a/query/graphql/schema/descriptions.go +++ b/query/graphql/schema/descriptions.go @@ -139,11 +139,10 @@ func (g *Generator) CreateDescriptions( if _, exists := desc.GetField(fname); exists { // lets make sure its an _id field, otherwise // we might have an error here - if strings.HasSuffix(fname, "_id") { - continue - } else { + if !strings.HasSuffix(fname, "_id") { return nil, fmt.Errorf("Error: found a duplicate field '%s' for type %s", fname, t.Name()) } + continue } fd := client.FieldDescription{ diff --git a/query/graphql/schema/generate.go b/query/graphql/schema/generate.go index 7128448e17..c6acb14afd 100644 --- a/query/graphql/schema/generate.go +++ b/query/graphql/schema/generate.go @@ -220,9 +220,9 @@ func (g *Generator) expandInputArgument(obj *gql.Object) error { case *gql.Object: if _, complete := g.expandedFields[fieldKey]; complete { continue - } else { - g.expandedFields[fieldKey] = true } + g.expandedFields[fieldKey] = true + // make sure all the sub fields are expanded first if err := g.expandInputArgument(t); err != nil { return err @@ -242,9 +242,8 @@ func (g *Generator) expandInputArgument(obj *gql.Object) error { listType := t.OfType if _, complete := g.expandedFields[fieldKey]; complete { continue - } else { - g.expandedFields[fieldKey] = true } + g.expandedFields[fieldKey] = true if listObjType, ok := listType.(*gql.Object); ok { if err := g.expandInputArgument(listObjType); err != nil { diff --git a/tools/configs/golangci.yaml b/tools/configs/golangci.yaml index 52a78f7864..d8efb2c9b8 100644 --- a/tools/configs/golangci.yaml +++ b/tools/configs/golangci.yaml @@ -95,6 +95,7 @@ linters: - errcheck - forbidigo - lll + - revive # - wrapcheck # - errorlint # - gci @@ -653,15 +654,8 @@ linters-settings: ignore-generated-header: true severity: warning rules: - - name: indent-error-flow - severity: warning - - name: add-constant - severity: warning - arguments: - - maxLitCount: "3" - allowStrs: '""' - allowInts: "0,1,2" - allowFloats: "0.0,0.,1.0,1.,2.0,2." + - name: superfluous-else + severity: error staticcheck: # Select the Go version to target. The default is '1.13'.