Skip to content

Commit

Permalink
refactor: remove unneeded check (#3394)
Browse files Browse the repository at this point in the history
  • Loading branch information
alexandear authored Nov 25, 2024
1 parent 4310a7f commit b110c1d
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 8 deletions.
6 changes: 6 additions & 0 deletions .golangci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,12 @@ linters-settings:
- paramTypeCombine
- preferFprint
- yodaStyleExpr
govet:
enable-all: true
disable:
- fieldalignment
- shadow
- unusedwrite # TODO: fix and enable
errcheck:
exclude-functions:
- (io.Writer).Write
Expand Down
11 changes: 3 additions & 8 deletions plugin/modelgen/models.go
Original file line number Diff line number Diff line change
Expand Up @@ -356,7 +356,6 @@ func (m *Plugin) generateField(
schemaType *ast.Definition,
field *ast.FieldDefinition,
) (*Field, error) {
var omittableType types.Type
var typ types.Type
fieldDef := cfg.Schema.Types[field.Type.Name()]

Expand Down Expand Up @@ -449,13 +448,9 @@ func (m *Plugin) generateField(
return nil, fmt.Errorf("generror: field %v.%v: omittable is only applicable to nullable input fields", schemaType.Name, field.Name)
}

var err error

if omittableType == nil {
omittableType, err = binder.FindTypeFromName("github.com/99designs/gqlgen/graphql.Omittable")
if err != nil {
return nil, err
}
omittableType, err := binder.FindTypeFromName("github.com/99designs/gqlgen/graphql.Omittable")
if err != nil {
return nil, err
}

f.Type, err = binder.InstantiateType(omittableType, []types.Type{f.Type})
Expand Down

0 comments on commit b110c1d

Please sign in to comment.