github.com/dolthub/go-mysql-server@v0.18.0/sql/mysql_db/fbs/generate.sh (about) 1 #!/bin/bash 2 3 set -eou pipefail 4 SRC=$(dirname ${BASH_SOURCE[0]}) 5 6 GEN_DIR="$SRC/../serial" 7 8 # cleanup old generated files 9 if [ ! -z "$(ls $GEN_DIR)" ]; then 10 rm $GEN_DIR/*.go 11 fi 12 13 # Last generated with github.com/dolthub/flatbuffers v23.3.3-dh.2 14 15 FLATC=${FLATC:=flatc} 16 17 # generate golang (de)serialization package 18 "$FLATC" -o $GEN_DIR --gen-onefile --filename-suffix "" --gen-mutable --go-namespace "serial" --go mysql_db.fbs 19 20 # prefix files with copyright header 21 for FILE in $GEN_DIR/*.go; 22 do 23 mv $FILE "tmp.go" 24 cat "copyright.txt" "tmp.go" >> $FILE 25 rm "tmp.go" 26 done 27 28 # format and remove unused imports 29 goimports -w $GEN_DIR