Files
wehub-resource-sync 5357c39144
Fuzzer / Run Fuzzer (push) Has been cancelled
Race tests / Go race tests (ubuntu-22.04) (push) Has been cancelled
chore: import upstream snapshot with attribution
2026-07-13 13:01:40 +08:00

29 lines
564 B
Bash
Executable File

#!/bin/bash
set -eou pipefail
FLATC="$1"
if [ ! -x "$FLATC" ]; then
echo "$FLATC is not an executable. Did you remember to run 'bazel build //:flatc' in $(dirname $(dirname $FLATC))"
exit 1
fi
shift
OUTDIR="$1"
shift
COPYRIGHTPATH="$1"
shift
# generate golang (de)serialization package
"$FLATC" -o "$OUTDIR" --gen-onefile --filename-suffix "" --gen-mutable --go-namespace "serial" --go "$@"
# prefix files with copyright header
for FILE in "$OUTDIR"/*.go;
do
tmp="$OUTDIR"/tmp
mv "$FILE" "$tmp"
cat "$COPYRIGHTPATH" "$tmp" > $FILE
rm "$tmp"
done