sogko / golang-relay-starter-kit

Barebones starting point for a Relay application with Golang GraphQL server

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

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

johanoskarsson opened this issue · 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

I have also encountered the same problem

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
}