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

Following the getting started fails with go1.18beta2 #1961

Closed
nlepage opened this issue Feb 10, 2022 · 21 comments
Closed

Following the getting started fails with go1.18beta2 #1961

nlepage opened this issue Feb 10, 2022 · 21 comments

Comments

@nlepage
Copy link

nlepage commented Feb 10, 2022

What happened?

Trying to follow the getting started fails at step go run github.com/99designs/gqlgen init.

Adding the --verbose flag produces the following error message:

internal error: package "github.com/vektah/gqlparser/v2/ast" without types was imported from "github.com/99designs/gqlgen/graphql/introspection"

Further executions of the generate command produce the same error.

What did you expect?

Being able to go through the getting started without errors.

Minimal graphql.schema and models to reproduce

N/A

versions

  • gqlgen v0.16.0
  • go v1.18beta2
  • go modules

Complete logs (reproduced in a docker container)

$ docker container run -it --rm golang:1.18-rc bash
root@bf9534c22485:/go# mkdir example
root@bf9534c22485:/go# cd example
root@bf9534c22485:/go# go mod init example
go: creating new go.mod: module example
root@bf9534c22485:/go/example# printf '// +build tools\npackage tools\nimport _ "github.com/99designs/gqlgen"' | gofmt > tools.go
root@bf9534c22485:/go# go mod tidy
go: finding module for package github.com/99designs/gqlgen
go: downloading github.com/99designs/gqlgen v0.16.0
go: found github.com/99designs/gqlgen in github.com/99designs/gqlgen v0.16.0
go: downloading github.com/matryer/moq v0.2.3
go: downloading github.com/urfave/cli/v2 v2.3.0
go: downloading github.com/vektah/gqlparser/v2 v2.2.0
go: downloading github.com/stretchr/testify v1.4.0
go: downloading github.com/gorilla/websocket v1.4.2
go: downloading golang.org/x/tools v0.1.5
go: downloading gopkg.in/yaml.v2 v2.2.4
go: downloading github.com/hashicorp/golang-lru v0.5.0
go: downloading github.com/mitchellh/mapstructure v1.2.3
go: downloading github.com/andreyvit/diff v0.0.0-20170406064948-c7f18ee00883
go: downloading github.com/agnivade/levenshtein v1.1.0
go: downloading gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15
go: downloading github.com/davecgh/go-spew v1.1.1
go: downloading github.com/pmezard/go-difflib v1.0.0
go: downloading github.com/sergi/go-diff v1.1.0
go: downloading github.com/kr/pretty v0.1.0
go: downloading github.com/kr/text v0.1.0
go: downloading github.com/cpuguy83/go-md2man/v2 v2.0.1
go: downloading github.com/dgryski/trifles v0.0.0-20200323201526-dd97f9abfb48
go: downloading github.com/arbovm/levenshtein v0.0.0-20160628152529-48b4e1c0c4d0
go: downloading github.com/russross/blackfriday/v2 v2.1.0
go: downloading golang.org/x/mod v0.4.2
go: downloading golang.org/x/sys v0.0.0-20210510120138-977fb7262007
go: downloading golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1
root@bf9534c22485:/go/example# go run github.com/99designs/gqlgen --verbose init
Creating gqlgen.yml
Creating graph/schema.graphqls
Creating server.go
Generating...
internal error: package "github.com/vektah/gqlparser/v2/ast" without types was imported from "github.com/99designs/gqlgen/graphql/introspection"
exit status 1
root@bf9534c22485:/go/example# go run github.com/99designs/gqlgen --verbose generate
internal error: package "github.com/vektah/gqlparser/v2/ast" without types was imported from "github.com/99designs/gqlgen/graphql/introspection"
exit status 1
@frederikhors
Copy link
Collaborator

frederikhors commented Feb 10, 2022

Please can you add a github repo for reproduction? Thanks.

@nlepage
Copy link
Author

nlepage commented Feb 10, 2022

Please can you add a github repo for reproduction. Thanks.

Sure.

Additional information: I managed to make it work on a fork by adding NeedDeps in the flags given to golang.org/x/tools/go/packages.Load(), however I have pretty much no idea what I am doing, and I did this to fix a different error...

@nlepage
Copy link
Author

nlepage commented Feb 10, 2022

@nlepage
Copy link
Author

nlepage commented Feb 10, 2022

The error I fixed by adding the NeedDeps flag was: Unexpected package creation during export data loading.

There is a go issue about this error: golang/go#45584, not sure if this is related.

@frederikhors
Copy link
Collaborator

I think we should wait for 1.18 stable to better understand. Please can you monitor this for us? You can close if it works when 1.18 stable is released. Thanks.

@nlepage
Copy link
Author

nlepage commented Feb 11, 2022

Please can you monitor this for us?

No problem.

@adaya-sprobe
Copy link

I just tried this using 1.18rc1. It works.

@nlepage
Copy link
Author

nlepage commented Mar 11, 2022

@adaya-sprobe This issue was reported for gqlgen v0.16.0, it seems to have been fixed in further versions...

gqlgen v0.16.0 is still broken with go1.18rc1, and will probably be with the final release.

It may have been fixed in gqlgen v0.17.0 by this commit : 9866507#diff-ca34562b44ad709eeae25522801f5282e8a197c52f345d38b13180c1cae88e83

@nlepage
Copy link
Author

nlepage commented Mar 11, 2022

The problem reported by this issue is fixed in gqlgen v0.17, so I'm closing this.

However I'm still having an issue with generate returning the error: Unexpected package creation during export data loading on a project I'm writing using go1.18, I will open another issue.

@nlepage nlepage closed this as completed Mar 11, 2022
@Desuuuu
Copy link
Contributor

Desuuuu commented Mar 11, 2022

The original issue with v0.16 can be solved by upgrading golang.org/x/tools to v0.1.8+.

As for the other issue, you can reproduce it using this: https://github.com/Desuuuu/gqlgen-issue

Adding the NeedDeps flag as mentionned in #1961 (comment) does seem to fix the problem.

@ivanvanderbyl
Copy link

ivanvanderbyl commented Mar 14, 2022

I'm still experiencing the Unexpected package creation during export data loading issue with v0.17.1 (Go 1.18-rc1), and updating golang.org/x/tools as mentioned above didn't help. However, the patch mentioned by @nlepage earlier does seem to fix the problem.

@nlepage
Copy link
Author

nlepage commented Mar 14, 2022

@ivanvanderbyl @Desuuuu I think this is worth opening another issue.

@frederikhors
Copy link
Collaborator

Please create a reproduction repo before opening a new issue.

@nlepage
Copy link
Author

nlepage commented Mar 14, 2022

Please create a reproduction repo before opening a new issue.

@frederikhors I think that's what @Desuuuu did, as mentionned in #1961 (comment) : https://github.com/Desuuuu/gqlgen-issue

@Desuuuu
Copy link
Contributor

Desuuuu commented Mar 14, 2022

The Unexpected package creation during export data loading bug appears to be an issue with golang.org/x/tools as well.

It has been reported here.

@frederikhors
Copy link
Collaborator

I think we should wait for 1.18 official to re-open this.

@mojtabacazi
Copy link

mojtabacazi commented Mar 16, 2022

I think we should wait for 1.18 official to re-open this.

@frederikhors go1.18 is out and as far as I can tell this is still an issue with gqlgen 17.1

it can be fixed by adding NeedDeps

@frederikhors
Copy link
Collaborator

@StevenACoffman I think we have a problem with Go 1.18. I'm reopening this. :(

@frederikhors frederikhors reopened this Mar 16, 2022
StevenACoffman added a commit that referenced this issue Mar 16, 2022
Signed-off-by: Steve Coffman <steve@khanacademy.org>
@StevenACoffman
Copy link
Collaborator

Thanks very much @nlepage, @mojtabacazi, @Desuuuu , and @ivanvanderbyl and @frederikhors !

@StevenACoffman
Copy link
Collaborator

BTW, I cut a new gqlgen v0.17.2 release now that Go 1.18 is out and I didn't see any reports of issues with the fix.

benjaminjkraft added a commit to Khan/genqlient that referenced this issue Mar 22, 2022
Go 1.18 is out! So we should run tests on it.

Additionally, gqlgen had some issues with it (see 99designs/gqlgen#1961
and golang/go#45584) so I updated that too, which updated some other
things.

Finally, latest gqlgen requires 1.16+, and it's time for us to do the
same anyway, so we can use `embed` and other newer goodies.  So I
dropped running tests for 1.14 and 1.15, and bumped the module language
version.

Test plan: make check
benjaminjkraft added a commit to Khan/genqlient that referenced this issue Mar 22, 2022
Go 1.18 is out! So we should run tests on it.

Additionally, gqlgen had some issues with it (see 99designs/gqlgen#1961
and golang/go#45584) so I updated that too, which updated some other
things.

Finally, latest gqlgen requires 1.16+, and it's time for us to do the
same anyway, so we can use `embed` and other newer goodies.  So I
dropped running tests for 1.14 and 1.15, and bumped the module language
version.

Test plan: make check
@LeugimAtreides
Copy link

Hello I'm running the tutorial and running gqlgen v0.17.2 and go1.18 windows/amd64 it appears that the command 'go run github.com/99designs/gqlgen init' causes this same issue again

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

8 participants