diff options
Diffstat (limited to 'vendor/github.com/99designs/gqlgen/codegen/field.go')
-rw-r--r-- | vendor/github.com/99designs/gqlgen/codegen/field.go | 14 |
1 files changed, 6 insertions, 8 deletions
diff --git a/vendor/github.com/99designs/gqlgen/codegen/field.go b/vendor/github.com/99designs/gqlgen/codegen/field.go index 264b59ce..fab26f2b 100644 --- a/vendor/github.com/99designs/gqlgen/codegen/field.go +++ b/vendor/github.com/99designs/gqlgen/codegen/field.go @@ -384,16 +384,16 @@ func (f *Field) ComplexitySignature() string { } func (f *Field) ComplexityArgs() string { - var args []string - for _, arg := range f.Args { - args = append(args, "args["+strconv.Quote(arg.Name)+"].("+templates.CurrentImports.LookupType(arg.TypeReference.GO)+")") + args := make([]string, len(f.Args)) + for i, arg := range f.Args { + args[i] = "args[" + strconv.Quote(arg.Name) + "].(" + templates.CurrentImports.LookupType(arg.TypeReference.GO) + ")" } return strings.Join(args, ", ") } func (f *Field) CallArgs() string { - var args []string + args := make([]string, 0, len(f.Args)+2) if f.IsResolver { args = append(args, "rctx") @@ -401,10 +401,8 @@ func (f *Field) CallArgs() string { if !f.Object.Root { args = append(args, "obj") } - } else { - if f.MethodHasContext { - args = append(args, "ctx") - } + } else if f.MethodHasContext { + args = append(args, "ctx") } for _, arg := range f.Args { |