Skip to content
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 incorrectly extracts module name from go.mod #2298

Closed
mobiletoly opened this issue Jul 21, 2022 · 5 comments
Closed

gqlgen incorrectly extracts module name from go.mod #2298

mobiletoly opened this issue Jul 21, 2022 · 5 comments

Comments

@mobiletoly
Copy link
Contributor

mobiletoly commented Jul 21, 2022

Costed me few hours today.

I was building a template (example) project for my team, so they could copy it, replace module name to what they need, fix few imports and run it.

While I was building it I was running go run github.com/99designs/gqlgen generate --verbose --config ./graph/gqlgen.yml to generate code from my schema and was getting this error:

reloading module info
reloading module info
merging type systems failed: unable to build input definition: unable to find type: name/internal/core/model.CalcInput
exit status 1

I was really puzzled where this "name" comes from in front of "internal/...". Ended up being that first few lines in my go.mod were

// TODO change module name
module some.repository.storage.com/some-repo/go-sample-service

go 1.18

require (
	github.com/99designs/gqlgen v0.17.13
...

so looks like gqlgen saw the word "module" and word "name" in comment and thought that "name" is actually a module name. I guess fix could be to ignore first lines if they are comments. Luckily go.mod syntax supports only // style comments, so no parsing of /* ... */ is needed.

@frederikhors
Copy link
Collaborator

Can you PR please?

@mobiletoly
Copy link
Contributor Author

Sure. Done:

#2299

@StevenACoffman
Copy link
Collaborator

Sorry for the inconvenience, but Thanks so much for the PR!

@frederikhors
Copy link
Collaborator

Closed by #2299.

@mobiletoly
Copy link
Contributor Author

thank you for such a great tool (gqlgen), really helps me a lot

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants