Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

gqlgen - DirectiveResolver not exported by package generated

Tags:

go

graphql

gqlgen

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

like image 403
Helen Grey Avatar asked Apr 16 '21 12:04

Helen Grey


1 Answers

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.

like image 56
FreezeLook Avatar answered Sep 28 '22 14:09

FreezeLook