mirror of
https://github.com/refraction-networking/uquic.git
synced 2025-04-04 20:57:36 +03:00
use a text-based comparison in the go-generate workflow
This commit is contained in:
parent
d1c5297c0b
commit
018b7dc76d
1 changed files with 12 additions and 9 deletions
21
.github/workflows/go-generate.sh
vendored
21
.github/workflows/go-generate.sh
vendored
|
@ -2,7 +2,14 @@
|
|||
|
||||
set -e
|
||||
|
||||
find . -type f -name "*.go" -exec shasum {} \; > checksums_before.txt
|
||||
DIR=$(pwd)
|
||||
TMP=$(mktemp -d)
|
||||
cd "$TMP"
|
||||
mkdir orig generated
|
||||
cp -r "$DIR" orig
|
||||
cp -r "$DIR" generated
|
||||
|
||||
cd generated
|
||||
# delete all go-generated files generated (that adhere to the comment convention)
|
||||
grep --include \*.go -lrIZ "^// Code generated .* DO NOT EDIT\.$" . | xargs --null rm
|
||||
# delete all files generated by Genny
|
||||
|
@ -11,11 +18,7 @@ grep --include \*.go -lrIZ "This file was automatically generated by genny." . |
|
|||
grep --include \*.go -lrI "//go:generate genny" | xargs -L 1 go generate
|
||||
# now generate everything
|
||||
go generate ./...
|
||||
find . -type f -name "*.go" -exec shasum {} \; > checksums_after.txt
|
||||
DIFF=$(diff checksums_before.txt checksums_after.txt) || true
|
||||
echo "$DIFF"
|
||||
if [ -n "$DIFF" ]; then
|
||||
exit 1
|
||||
else
|
||||
echo "All generated files match."
|
||||
fi
|
||||
cd ..
|
||||
|
||||
# don't compare fuzzing corpora
|
||||
diff --exclude=corpus -ruN orig generated
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue