-
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
Build Errors with v0.17.64 #3517
Comments
Whenever I run into Check if that helps. |
Any workaround or update on this issue? |
tried it doesn't help |
Hi! Is it possible for you to set up a public repository that demonstrates this or a similar issue so I can see what is going on? |
Hi, I just had an error similar to this one. In my case it was a version update from version __InputValueResolver redeclared in this block (see details)compiler[DuplicateDecl](https://pkg.go.dev/golang.org/x/tools/internal/typesinternal#DuplicateDecl)
prelude.resolvers.go(35, 6):
type __InputValueResolver interface { // size=16 (0x10)
IsDeprecated(ctx context.Context, obj *introspection.InputValue) (bool, error)
DeprecationReason(ctx context.Context, obj *introspection.InputValue) (*string, error)
} I tried to generate exec in a different package but it seems that, since name __InputValueResolver not exported by package genertedcompiler[UnexportedName](https://pkg.go.dev/golang.org/x/tools/internal/typesinternal#UnexportedName)
type __InputValueResolver interface {
IsDeprecated(ctx context.Context, obj *introspection.InputValue) (bool, error)
DeprecationReason(ctx context.Context, obj *introspection.InputValue) (*string, error)
} I might be doing something wrong, but since we can change the name of the generated revolvers this isn't blocking for me, just wanted to add some info. |
Thank you all, these are very valuable reports! Can you all please take a moment to run this and report back what it says:
Even if you are, if more than one person is doing something wrong, then it's a sign that something should be improved so it is easier to do the right thing, harder to do the wrong thing, or at least the error message should be better at telling people what to do different! My theory as to what might be happening to you all is that you are only partially upgraded. In #3507 I had to make a change to gqlgen to avoid this exact problem. There are really two gqlgen versions to worry about. There's gqlgen-the-library and gqlgen-the-codegen-binary-command-line-tool. When you run However, if you have previously installed an older version of gqlgen as a binary command line tool by doing something like:
and then when you are regenerating your resolvers using this older version of gqlgen, your resolvers would exhibit this exact behavior! So... I think that's what's going on. Please let me know what you find out! |
Thank you for the swift response! For the two things I wrote about the problem seems to still happen in I replaced the I think it would be useful if the interfaces didn't start with But given that I have a workaround at least this is not breaking |
I'm getting this error as well but I'm not sure why. It happened after I upgraded to Go 1.24 and It seems to have generated this code in // __InputValue returns graph.__InputValueResolver implementation.
func (r *Resolver) __InputValue() graph.__InputValueResolver { return &__InputValueResolver{r} }
// __Type returns graph.__TypeResolver implementation.
func (r *Resolver) __Type() graph.__TypeResolver { return &__TypeResolver{r} } And then the type __InputValueResolver interface {
IsDeprecated(ctx context.Context, obj *introspection.InputValue) (bool, error)
DeprecationReason(ctx context.Context, obj *introspection.InputValue) (*string, error)
}
type __TypeResolver interface {
IsOneOf(ctx context.Context, obj *introspection.Type) (*bool, error)
} However it's not able to be imported, which seems to be because of the I've also tried |
If anyone can provide a public repository where I can reproduce their issue, I would love to take a look, but I'm really not able to reproduce this behavior, so I'm just guessing that it is a local environment issue of some sort, rather than a specific code issue. |
I was able to reproduce the issue on my side. The error was that I was using go 1.24 to generate. Once I've set back go 1.23, I was able to generate back again. So as @StevenACoffman, this is env issue where you try to generate with version 1.24, most. probably. |
@k3v3n I'm glad you seem to be able to temporarily work around your issue. If you can set up a public repository somewhere, I would still love to try to examine it, as when I use Go 1.24 in our testing matrix here and in other repositories, I can't reproduce this issue. |
Thanks, that is spot on! I was getting the same error in Go generate directive was set up as: But go.mod had: So I'm guessing the generator couldn't find types to bind to, and generated them instead. The fix was simply bump both P.S. Ironically the reason to upgrade for me is migration to Go 1.24 to use |
As of v0.17.64, running
gqlgen generate
causes a file to be generated calledprelude.resolvers.go
that includes build errors. If I roll back to v0.17.64 the file is not generated and the build is successful.The errors reported:
The text was updated successfully, but these errors were encountered: