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

Replace Invalid Characters in Package Name with an Underscore #75

Merged
merged 1 commit into from
Apr 4, 2018
Merged

Replace Invalid Characters in Package Name with an Underscore #75

merged 1 commit into from
Apr 4, 2018

Conversation

mathewbyrne
Copy link
Contributor

Came across this while trying to map a schema type to an import from a package with a dash in the name. gqlgen will currently use the last part of the import path as the local import identifier. This leads to a syntax error in the generated code.

This PR ensures a valid identifier by sanitising local import names to a valid go identifier by replacing any non-word characters with an underscore.

This will sanatise local import names to a valid go identifier by
replacing any non-word characters with an underscore.
@vektah
Copy link
Collaborator

vektah commented Apr 4, 2018

Thanks for the PR 👌

@vektah vektah merged commit e266fab into 99designs:master Apr 4, 2018
cgxxv pushed a commit to cgxxv/gqlgen that referenced this pull request Mar 25, 2022
cgxxv pushed a commit to cgxxv/gqlgen that referenced this pull request Mar 25, 2022
Replace Invalid Characters in Package Name with an Underscore
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 this pull request may close these issues.

None yet

2 participants