gqlgenc
gqlgenc copied to clipboard
nil pointer deref on first run
Trying to debug this but haven't gotten to the bottom of it yet. Using hasura as my server w/ just one table.
❯ gqlgenc
panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x2 addr=0x28 pc=0x100433d00]
goroutine 1 [running]:
github.com/Yamashou/gqlgenc/clientgen.RenderTemplate(0x14000083380, 0x1400bea4fc0, 0x1400bea50e0, 0x1008beb60, 0x0, 0x0, 0x1008beb60, 0x0, 0x0, 0x1008beb60, ...)
/.../go/pkg/mod/github.com/!yamashou/[email protected]/clientgen/template.go:22 +0x2c0
github.com/Yamashou/gqlgenc/clientgen.(*Plugin).MutateConfig(0x140000e4a80, 0x14000083380, 0x140000e4a80, 0x128f3a1e8)
/.../go/pkg/mod/github.com/!yamashou/[email protected]/clientgen/client.go:80 +0x62c
github.com/Yamashou/gqlgenc/generator.Generate(0x1005f1630, 0x140000ac000, 0x140000d07e0, 0x14000107f50, 0x1, 0x1, 0x14000036800, 0x100081584)
/.../go/pkg/mod/github.com/!yamashou/[email protected]/generator/generater.go:52 +0x230
main.main()
/.../go/pkg/mod/github.com/!yamashou/[email protected]/main.go:30 +0x154
With this yaml config:
model:
package: generated
filename: ./generated/models.go # http://localhost:8080/v1/graphql
client:
package: generated
filename: ./generated/client.go # Where should any generated client go?
models:
Int:
model: github.com/99designs/gqlgen/graphql.Int64
Date:
model: github.com/99designs/gqlgen/graphql.Time
endpoint:
url: http://localhost:8080/v1/graphql # Where do you want to send your request?
headers:
x-hasura-admin-secret: admin-secret # support environment variables
query:
- "./query/*.graphql" # Where are all the query files located?
looks like the generate
section of the config is required but not documented in the Readme. I had to add this:
generate:
client: true