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

fix(golang): Escape reserved keywords #2849

Merged
merged 2 commits into from
Oct 13, 2023
Merged

Conversation

kyleconroy
Copy link
Collaborator

Append _ to variable names that are reserved

Fixes #2267

Append `_` to variable names that are reserved
@andrewmbenton
Copy link
Collaborator

Honestly I don't think I would even bother checking for reserved words, since that list is something we'll have to keep up to date. I would just append or prepend "_" to every variable name since they are all internal to sqlc's funcs anyway.

@kyleconroy
Copy link
Collaborator Author

kyleconroy commented Oct 13, 2023

The list of reserved words in Go is very short and changes infrequently. I don't think they've added one for years. I'd rather not generated a large diff for existing users.

@kyleconroy kyleconroy merged commit 3ae9e3c into main Oct 13, 2023
8 checks passed
@kyleconroy kyleconroy deleted the kyle/codegen-go-keywords branch October 13, 2023 18:36
This pull request was closed.
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.

Generated code uses Go keyword resulting in a syntax error
2 participants