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

generating core failed: unable to load example/graph/model in v0.16 #1860

Closed
aleybovich opened this issue Jan 26, 2022 · 7 comments · Fixed by #1872
Closed

generating core failed: unable to load example/graph/model in v0.16 #1860

aleybovich opened this issue Jan 26, 2022 · 7 comments · Fixed by #1872

Comments

@aleybovich
Copy link
Contributor

What happened?

When using v0.15 and following the examples, everything worked.

After switching the new 0.16 release, when I run go run github.com/99designs/gqlgen init I get this error:

/api # go run github.com/99designs/gqlgen init
Creating gqlgen.yml
Creating graph/schema.graphqls
Creating server.go
Generating...
reloading module info
generating core failed: unable to load example/graph/model - make sure you're using an import path to a package that exists

and server.go is not generated.

What did you expect?

No errors, server.go is generated

Minimal graphql.schema and models to reproduce

N/A as the issue is happening before code generation

versions

  • gqlgen version? 0.16.0
  • go version? go version go1.16.13 linux/amd64
  • dep or go modules?
@frederikhors
Copy link
Collaborator

@StevenACoffman this is coming back several times.

Can we comment the autobind in https://gqlgen.com/config? People are copying and pasting that config when getting started.

@StevenACoffman
Copy link
Collaborator

I think that's fine, but if you could run through the steps and verify that that doesn't cause any different problems, I would feel better doing that. I kind of blew my OSS time budget for the week on the parser yesterday. 😞

@softshipper
Copy link

softshipper commented Jan 30, 2022

Hi all,
I have the same problem and I could not figure out why it happens. When I run go run github.com/99designs/gqlgen generate it shows the following error message:

go run github.com/99designs/gqlgen generate
reloading module info
generating core failed: unable to load calshare.io/service/graph/model - make sure you're using an import path to a package that exists

and running go mod tidy it shows:

go: finding module for package calshare.io/service/graph/generated
go: finding module for package calshare.io/service/graph/model
calshare.io/service imports
        calshare.io/service/graph/generated: cannot find module providing package calshare.io/service/graph/generated: unrecognized import path "calshare.io/service/graph/generated": https fetch: Get "https://calshare.io/service/graph/generated?go-get=1": dial tcp: lookup calshare.io: no such host
calshare.io/service/graph imports
        calshare.io/service/graph/model: cannot find module providing package calshare.io/service/graph/model: unrecognized import path "calshare.io/service/graph/model": https fetch: Get "https://calshare.io/service/graph/model?go-get=1": dial tcp: lookup calshare.io: no such host

Would be great if someone can help.
service.zip

@frederikhors
Copy link
Collaborator

@softshipper @aleybovich can you please comment out autobind in config and try again?

@frederikhors
Copy link
Collaborator

I think that's fine, but if you could run through the steps and verify that that doesn't cause any different problems, I would feel better doing that. I kind of blew my OSS time budget for the week on the parser yesterday. 😞

I will in a few hours, @StevenACoffman.

@softshipper
Copy link

@frederikhors Thanks for your help. It works now. Why do we have to delete autobind?

@frederikhors
Copy link
Collaborator

@frederikhors Thanks for your help. It works now. Why do we have to delete autobind?

Because the autobind is used to tell gqlgen where to look for ANY POSSIBLE already created structs that you can use IF COMPATIBLE with the GraphQL schema you are using to generate.

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

Successfully merging a pull request may close this issue.

4 participants