-
Notifications
You must be signed in to change notification settings - Fork 1.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
gqlgen init error in loading gqlparser. #1402
Comments
This is referenced in #1105, if you look at the go.mod file for gqlgen, you can see that the module is defined as Like #1105 says, if you're not running in go module mode, I believe If you're ok with using go module mode, then an easy fix for it is to:
If your project is called
When you run Your previous application probably used a sub-2.0 version of gqlgen, which would have the module defined without the |
Presently:
I've run go.mod
|
I have had the same issue, I have run $ go run github.com/99designs/gqlgen init
validation failed: packages.Load: /Users/rokiyama/projects/gqlgen-todos/graph/prelude.resolvers.go:19:44: __DirectiveResolver not exported by package generated full logs: $ mkdir gqlgen-todos
$ cd gqlgen-todos
$ go mod init github.com/rokiyama/gqlgen-todos
go: creating new go.mod: module github.com/rokiyama/gqlgen-todos
$ go get github.com/99designs/gqlgen
go get: added github.com/99designs/gqlgen v0.13.0
$ go get github.com/vektah/gqlparser/v2
go get: upgraded github.com/vektah/gqlparser/v2 v2.1.0 => v2.2.0
$ go run github.com/99designs/gqlgen init
validation failed: packages.Load: /Users/rokiyama/projects/gqlgen-todos/graph/prelude.resolvers.go:19:44: __DirectiveResolver not exported by package generated
Exec "go run ./server.go" to start GraphQL server
$ go run ./server.go
# github.com/rokiyama/gqlgen-todos/graph
graph/prelude.resolvers.go:19:34: cannot refer to unexported name generated.__DirectiveResolver my go.mod: module github.com/rokiyama/gqlgen-todos
go 1.16
require (
github.com/99designs/gqlgen v0.13.0 // indirect
github.com/vektah/gqlparser/v2 v2.2.0 // indirect
) |
Looks like this may be an issue with gqlparser v2.2.0 (released 8 days ago as of this post). I haven't looked into the specifics, but I just was able to replicate the behavior you mention on my system, then fix it with the resolution mentioned here. Basically, in your
Credit to FreezeLook for this solution. |
Looks like this change is being discussed over in vektah/gqlparser#154. |
@diffuse The solution worked for me. Thank you. |
I guess https://github.com/99designs/gqlgen/blob/master/graphql/introspection/introspection.go#L12 is missing in |
@KellyLSB please tell me if this is still an issue with v0.16.0 and I'll re-open it. |
What happened?
What did you expect?
A v2 directory within gqlparser; or... something
Minimal graphql.schema and models to reproduce
This is the project init
versions
gqlgen version
? mastergo version
? go1.15.5 linux/amd64This has not been a problem in my older application of gqlgen; merely the new init.
The text was updated successfully, but these errors were encountered: