graphql-go / graphql

An implementation of GraphQL for Go / Golang
MIT License
9.87k stars 839 forks source link

BindFields with pointer types #567

Open c0ze opened 4 years ago

c0ze commented 4 years ago

I get a

panic: reflect: call of reflect.Value.Field on zero Value

goroutine 1 [running]:
reflect.Value.Field(0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x4f2ccc0)
    /Users/arda/.gvm/gos/go1.12.4/src/reflect/value.go:813 +0x127
github.com/graphql-go/graphql.BindFields(0x4b62dc0, 0x0, 0x0)
    /Users/arda/.gvm/pkgsets/go1.12.4/global/pkg/mod/github.com/graphql-go/graphql@v0.7.10-0.20200817033913-d6b7434614ec/util.go:44 +0x4b8
github.com/graphql-go/graphql.BindFields(0x4c2d060, 0xc00000c1e0, 0x4c2d060)
    /Users/arda/.gvm/pkgsets/go1.12.4/global/pkg/mod/github.com/graphql-go/graphql@v0.7.10-0.20200817033913-d6b7434614ec/util.go:50 +0x57c

When I use a struct with a pointer type field. Is there a way to make this work ?

Also, is there a guide/docs somewhere ?