Skip to content

Commit

Permalink
Fix codegen (#16257)
Browse files Browse the repository at this point in the history
Signed-off-by: Dirkjan Bussink <[email protected]>
Signed-off-by: Florent Poinsard <[email protected]>
Co-authored-by: Florent Poinsard <[email protected]>
  • Loading branch information
dbussink and frouioui authored Jun 25, 2024
1 parent 048d4d2 commit c41f0a8
Show file tree
Hide file tree
Showing 3 changed files with 40 additions and 2 deletions.
15 changes: 15 additions & 0 deletions .github/workflows/static_checks_etc.yml
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,16 @@ jobs:
- 'bootstrap.sh'
- 'misc/git/hooks/asthelpers'
- '.github/workflows/static_checks_etc.yml'
astfmt:
- 'go/tools/astfmtgen/**'
- 'go/vt/sqlparser/**'
- 'Makefile'
- 'build.env'
- 'go.sum'
- 'go.mod'
- 'tools/**'
- 'bootstrap.sh'
- '.github/workflows/static_checks_etc.yml'
end_to_end:
- 'docker/**'
- 'test.go'
Expand Down Expand Up @@ -168,6 +178,11 @@ jobs:
if: steps.skip-workflow.outputs.skip-workflow == 'false' && (steps.changes.outputs.visitor == 'true' || steps.changes.outputs.go_files == 'true')
run: |
misc/git/hooks/asthelpers || exit 1
- name: check_ast_format_fast
if: steps.skip-workflow.outputs.skip-workflow == 'false' && (steps.changes.outputs.astfmt == 'true' || steps.changes.outputs.go_files == 'true')
run: |
./tools/check_astfmtgen.sh || exit 1
- name: run ensure_bootstrap_version
if: steps.skip-workflow.outputs.skip-workflow == 'false' && steps.changes.outputs.end_to_end == 'true'
Expand Down
6 changes: 4 additions & 2 deletions go/vt/sqlparser/ast_format_fast.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

21 changes: 21 additions & 0 deletions tools/check_astfmtgen.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
#!/bin/bash

#
# Validate that the current version of ast_format_fast matches what gets generated.
#

source build.env

first_output=$(git status --porcelain)

go run ./go/tools/astfmtgen vitess.io/vitess/go/vt/sqlparser/...

second_output=$(git status --porcelain)

diff=$(diff <( echo "$first_output") <( echo "$second_output"))

if [[ "$diff" != "" ]]; then
echo "ERROR: Regenerated ast_format_fast file do not match the current version."
echo -e "File containing differences:\n$diff"
exit 1
fi

0 comments on commit c41f0a8

Please sign in to comment.