Conversation
bgentry
approved these changes
Apr 27, 2025
Contributor
bgentry
left a comment
There was a problem hiding this comment.
LGTM aside from comment issue ✌️
| require.EqualError(t, err, "sqlctemplate found template-like tag after replacements; probably syntax error or missing end tag: /* TEMPLATE_BEGIN") | ||
| } | ||
|
|
||
| // Missing "TEMPLATE_END". |
Contributor
There was a problem hiding this comment.
wrong comment? This one has TEMPLATE_END
Contributor
Author
There was a problem hiding this comment.
Whoops, that's right. Fixed.
…akes While implementing #848 I made a couple typos in SQL queries at a few points where I made some minor problem in a template tag like putting in `/* TEMPLATE schema */` instead of `/* TEMPLATE: schema */`. sqlctemplate isn't a real compiler, so instead of these problems getting flagged, they're silently ignored, and this is made even worse because sqlc strips comments from queries so we often end up with absolutely nothing to debug with. This results in a long, frustrating debugging experience. Here, perform a post-replace match to check for obvious problems and tell the caller about them immediately. It's not perfect, but will save time in diagnosing common problems.
abf7b28 to
dec0cca
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
While implementing #848 I made a couple typos in SQL queries at a few
points where I made some minor problem in a template tag like putting in
/* TEMPLATE schema */instead of/* TEMPLATE: schema */.sqlctemplate isn't a real compiler, so instead of these problems getting
flagged, they're silently ignored, and this is made even worse because
sqlc strips comments from queries so we often end up with absolutely
nothing to debug with. This results in a long, frustrating debugging
experience.
Here, perform a post-replace match to check for obvious problems and
tell the caller about them immediately. It's not perfect, but will save
time in diagnosing common problems.