golang-relay-starter-kit icon indicating copy to clipboard operation
golang-relay-starter-kit copied to clipboard

data/schema.go:44: cannot use func literal

Open johanoskarsson opened this issue 8 years ago • 2 comments

Attempted to follow the instructions but I get the following error. I assume something changed in graphql-go?

$ go get -v github.com/graphql-go/handler (download) github.com/graphql-go/handler github.com/sogko/golang-relay-starter-kit/data

github.com/sogko/golang-relay-starter-kit/data

data/schema.go:44: cannot use func literal (type func(interface {}, graphql.ResolveInfo) *graphql.Object) as type graphql.ResolveTypeFn in field value

johanoskarsson avatar Oct 27 '16 23:10 johanoskarsson

I have also encountered the same problem

lei314121077 avatar Feb 07 '17 09:02 lei314121077

I solved the problem,this is my code. TypeResolve: func(p graphql.ResolveTypeParams) *graphql.Object { switch p.Value.(type) { case *User: return userType case *Widget: return widgetType } return nil }

lei314121077 avatar Feb 08 '17 01:02 lei314121077