The canonical usage of context in Go is to pass it in as the first argument
to all functions that accept it. This changes gqlclientgen to generate code
accepting context as the first parameter.
---
cmd/gqlclientgen/main.go | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/cmd/gqlclientgen/main.go b/cmd/gqlclientgen/main.go
index 541f5e0..8a1e920 100644
--- a/cmd/gqlclientgen/main.go+++ b/cmd/gqlclientgen/main.go
@@ -302,8 +302,8 @@ func genOp(schema *ast.Schema, op *ast.OperationDefinition) *jen.Statement {
var stmts, in, out, ret, dataFields []jen.Code
- in = append(in, jen.Id("client").Op("*").Qual(gqlclient, "Client")) in = append(in, jen.Id("ctx").Qual("context", "Context"))
+ in = append(in, jen.Id("client").Op("*").Qual(gqlclient, "Client")) stmts = append(stmts, jen.Id("op").Op(":=").Qual(gqlclient, "NewOperation").Call(jen.Lit(queryStr)))
--
2.40.1