-
Notifications
You must be signed in to change notification settings - Fork 3.9k
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
build: add missing plpgsql build rules #101930
Conversation
15cc543
to
99dc2c8
Compare
The main issue I'm seeing here is that the new plpgsql depends on the sql/parser package; and so the source code for the latter needs to be ready before the source code for the former is processed. I'll show what I mean in a separate commit. |
Ok we're out of the woods - i seems the package dependency doesn't matter for file generation. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hm, we are getting this error still undefined: lexbase
, previously the error was undefined: lexbase.DOT_DOT
or other keyword. Ricky thinks that goimports might not be getting called, or maybe it is returning an incorrect result for some reason.
Reviewable status: complete! 0 of 0 LGTMs obtained
drat, it failed again. I'm looking further now |
This is the failure:
I think i know what's up. i'll try something. |
Here's how to repro locally:
The issue is because the code needs to import there are 2 fixes possible:
I think the latter is easier. I'll try this next. |
Next hurdle below . @rickystewart why did the Bazel CI target not find this already? Is this linter not running in bazel? It's a super important linter.
|
Generally we don't have lints on for generated code. |
@ZhouXing19 you might be interested in the diff for the latest commit I added to this PR. --- a/pkg/sql/plpgsql/parser/plpgsql.y
+++ b/pkg/sql/plpgsql/parser/plpgsql.y
@@ -688,7 +689,8 @@ getdiag_item: unreserved_keyword {
case "returned_sqlstate":
$$.val = plpgsqltree.PlpgsqlGetdiagReturnedSqlstate;
default:
- setErr(plpgsqllex, errors.New("unrecognized GET DIAGNOSTICS item " + $1 ))
+ // TODO(jane): Should this use an unimplemented error instead?
+ setErr(plpgsqllex, errors.Newf("unrecognized GET DIAGNOSTICS item: %s", redact.Safe($1)))
}
} |
@rickystewart This is a problem: the "generated code" for all files is generated from templates that do not have the .go extension, but are written by humans. If these templates contain code that violates our lint rules and bazel doesn't detect that, it's bad. |
Filed this separate issue for that: #102191. |
If we can find a list of which "generated code" files should and should not be linted, then it'll be easy to apply it. I suspect that we have not fully thought through which "generated code" files are and are not lint-worthy. |
Let's move the lint discussion to #102191. |
I'm cautiously optimistic that my latest amend has fixed the remaining CI issues. I'll disconnect from the computer now. If CI is indeed happy in the end feel free to squash and merge. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM modulo squashing the commits together.
NB: you'll need to git fetch
(or pull
) my last commit locally from your remote branch before you can squash.
i'm going to go ahead and merge this so that the remainder of the team doesn't continue to worry something is amiss. bors r+ |
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
The "Github CI"/ "Lint" target in TC was failing due to missing plpgsql build rules. This commit should add the rules. Release note: None
This comment was marked as outdated.
This comment was marked as outdated.
Build succeeded: |
blathers backport 23.1 22.2 |
Encountered an error creating backports. Some common things that can go wrong:
You might need to create your backport manually using the backport tool. error creating merge commit from b7ba298 to blathers/backport-release-23.1-101930: POST https://api.github.com/repos/cockroachdb/cockroach/merges: 409 Merge conflict [] you may need to manually resolve merge conflicts with the backport tool. Backport to branch 23.1 failed. See errors above. error creating merge commit from b7ba298 to blathers/backport-release-22.2-101930: POST https://api.github.com/repos/cockroachdb/cockroach/merges: 409 Merge conflict [] you may need to manually resolve merge conflicts with the backport tool. Backport to branch 22.2 failed. See errors above. 🦉 Hoot! I am a Blathers, a bot for CockroachDB. My owner is dev-inf. |
Resolve: #101544
The "Github CI"/ "Lint" target in TC was failing due to missing plpgsql build rules. This commit should add the rules.
Release note: None