gqlgen - DirectiveResolver not exported by package generated

3.3k Views Asked by At

I am new to GraphQL, gqlgen library. Tried running go run github.com/99designs/gqlgen init command but getting validation failed: packages.Load: C:\Users\Aylin\Desktop\gqlgen-tutorial\graph\prelude.resolvers.go:19:44: __DirectiveResolver not exported by package generated error. This is the first step of the project setup and is not supposed to cause any errors. Anyone had the same problem and knows how to fix it? Thanks

1

There are 1 best solutions below

1
On BEST ANSWER

I took this one and I've resolved it. Change version for "github.com/vektah/gqlparser/v2" in your go.mod file. From:

go 1.16
require (
    github.com/99designs/gqlgen v0.13.0
    github.com/vektah/gqlparser/v2 v2.2.0
)

To:

github.com/vektah/gqlparser/v2 v2.1.0

Delete prelude.resolvers.go after that.