sogko / golang-relay-starter-kit

Barebones starting point for a Relay application with Golang GraphQL server
Other
137 stars 30 forks source link

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

Open johanoskarsson opened 7 years ago

johanoskarsson commented 7 years ago

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

lei314121077 commented 7 years ago

I have also encountered the same problem

lei314121077 commented 7 years ago

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 }