Skip to content

Commit

Permalink
metalinter
Browse files Browse the repository at this point in the history
  • Loading branch information
asamusev committed Dec 1, 2018
1 parent 526bef0 commit a13b31e
Show file tree
Hide file tree
Showing 14 changed files with 181 additions and 161 deletions.
5 changes: 3 additions & 2 deletions codegen/templates/args.gotpl
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
args := map[string]interface{}{}
var err error
{{- range $i, $arg := . }}
var arg{{$i}} {{$arg.Signature }}
if tmp, ok := rawArgs[{{$arg.GQLName|quote}}]; ok {
Expand Down Expand Up @@ -30,6 +29,7 @@
return nil, errors.New("expect {{$arg.Signature }}")
}
{{ else }}
var err error
{{$arg.Unmarshal (print "arg" $i) "tmp" }}
if err != nil {
return nil, err
Expand All @@ -41,6 +41,7 @@
{{- end }}

{{ else }}
var err error
{{$arg.Unmarshal (print "arg" $i) "tmp" }}
if err != nil {
return nil, err
Expand All @@ -49,4 +50,4 @@
}
args[{{$arg.GQLName|quote}}] = arg{{$i}}
{{- end }}
return args, err
return args, nil
4 changes: 2 additions & 2 deletions codegen/templates/data.go

Large diffs are not rendered by default.

3 changes: 1 addition & 2 deletions codegen/templates/input.gotpl
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@
{{- end }}

func (e *executableSchema) {{ .GQLType }}Middleware(ctx context.Context, obj *{{.FullName}}) (*{{.FullName}}, error) {
var err error
{{ if .Directives }}
cObj, err := graphql.ChainFieldMiddleware(
[]graphql.FieldMiddleware{
Expand Down Expand Up @@ -109,5 +108,5 @@
{{ $field.Middleware (print "obj." $field.GoFieldName ) (print "obj." $field.GoFieldName ) }}
{{- end }}
{{- end }}
return obj, err
return obj, nil
}

0 comments on commit a13b31e

Please sign in to comment.