Closed shimish2 closed 2 years ago
Please create a reproduction repo.
Please checkout this changes https://github.com/project-zot/zot/tree/main/pkg/extensions/search and try to run go generate
from search directory.
Can you try with 0.17.9, please?
tried with 0.17.9 and got same error.
Same issue with the latest version and downgrading gqlgen
to v0.14.0 works for me as well.
Hi, Looks like sticking to the v0.14.0 workaround is not working with Go 1.18 because it doesn't have the fix for #1961 (works with 1.17). Do we have a long term solution?
any updates here ? go run github.com/99designs/gqlgen generate
still fails
$ go version
go version go1.18 darwin/arm64
For our project we started from scratch with gqlgen init
, replaced the schema with ours, and did some code refactoring to move our resolvers to match the new file/folder structure (before this we did not have a gqlgen.yml, or a schema.resolvers.go file - the methods in schema.resolvers.go were implemented in resolvers.go).
Currently it's working with latest gqlgen and go1.18.
This is not a problem anymore with gqlgen latest versions and Go 1.16.x, 1.17.x, 1.18x.
Maybe you can use gqlgen init
from scratch in a new dir and notice the differences from your project.
Or you can re-check re-reading the config page.
Definitely this is not something wrong with latest versions, hence I'm closing this.
I found the cause of this issue. If you running generate with no gqlgen.yml
file you will be getting this error because generated code will contain this piece of code:
resTmp := ec._fieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) {
ctx = rctx // use context from middleware stack in children
return obj.ID, nil
})
This is where it comes from https://github.com/99designs/gqlgen/blob/6855b7290cab62a1fc6a26a2b633e0b5bbf248da/codegen/field.gotpl#L19-L23
Once you add gqlgen.yml
everything works well.
Probably $.AllDirectives.LocationDirectives
var initialises wrong without config file.
What happened?
I am getting error while running go generate
ec._fieldMiddleware undefined (type *executionContext has no field or method _fieldMiddleware)
What did you expect?
go generate should run successfully. After downgrading gqlgen to v1.14.0 & gqlparser to v2.2.0, go generate was successful.
versions
go run github.com/99designs/gqlgen version
? v0.17.8go version
? 1.18