Skip to content

Conversation

@snprajwal
Copy link

@snprajwal snprajwal commented May 13, 2025

Constant names in queries were not escaped, leading to keywords being emitted as constant names in the generated output. This has been updated to be escaped, and any has been added as a reserved keyword as of Go 1.18.

This also addresses the lint raised by gopls on sqlc's generated Go files for modernizing the usage of an empty interface for the any type.

@dosubot dosubot bot added size:M This PR changes 30-99 lines, ignoring generated files. 🔧 golang labels May 13, 2025
@dosubot dosubot bot added size:L This PR changes 100-499 lines, ignoring generated files. and removed size:M This PR changes 30-99 lines, ignoring generated files. labels May 13, 2025
@snprajwal
Copy link
Author

Interesting, it looks like the generated names for constants are not escaped

snprajwal added 2 commits May 13, 2025 21:52
Also adds `any` as a reserved keyword, as it was introduced in Go 1.18.

Signed-off-by: Prajwal S N <prajwalnadig21@gmail.com>
Signed-off-by: Prajwal S N <prajwalnadig21@gmail.com>
@snprajwal
Copy link
Author

@kyleconroy I just realised this might be noisier than needed, since the linter ignores generated files. Would you want me to split the bug fix out into a separate PR and close this?

@snprajwal
Copy link
Author

@kyleconroy gentle ping, this fixes an actual bug, I've renamed the PR to better reflect that :)

@snprajwal snprajwal changed the title chore: use any in place of interface{} fix: escape constant names in queries Nov 21, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size:L This PR changes 100-499 lines, ignoring generated files. 🔧 golang

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant