-
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
Import resolver bugs. #60
Labels
bug
Something isn't working
Comments
Thanks for the bug report, should be fixed now. |
Cheers for the quick resolution. |
I seem to be experiencing this issue again (I'm using --- a/foo/apigraphql/generated.go
+++ b/foo/apigraphql/generated.go
@@ -1,4 +1,4 @@
-// This file was generated by github.com/vektah/gqlgen, DO NOT EDIT
+// Code generated by github.com/vektah/gqlgen, DO NOT EDIT.
package apigraphql
@@ -6,33 +6,154 @@ import (
"bytes"
context "context"
apimodel "foo/apimodel"
- query1 "foo/query"
+ query "foo/query"
strconv "strconv"
graphql "github.com/vektah/gqlgen/graphql"
introspection "github.com/vektah/gqlgen/neelance/introspection"
- query "github.com/vektah/gqlgen/neelance/query"
schema "github.com/vektah/gqlgen/neelance/schema"
)
as a result the code obviously doesn't compile anymore:
|
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
When attempting to generate code from a schema, a panic is thrown in
import_build.go
when attempting to resolve imports. The import path for my all of my types matches thename
of one of the core imports the generated code relies on. i.e: my package:/path/to/package/introspection
which conflicts with internal package:github.com/vektah/gqlgen/neelance/introspection
(As they have the same base-name). I think this is down to line 40 inimport_build.go
:for imp := imports.findByName(localName); imp != nil && imp.Package != t.Package; localName = filepath.Base(t.Package) + strconv.Itoa(i) { ... }
As for the example above: for the first iteration it will find match for the first iteration with the package:
github.com/vektah/gqlgen/neelance/introspection
, but will fail theimp != nil && imp.Package != t.Package
condition. On any subsequent iteration however, the new name (i.e introspection1, ...2, ..3) will never match a package thus causing thepanic('too many collisions')
error.The text was updated successfully, but these errors were encountered: