mirror of
https://github.com/tendermint/tendermint.git
synced 2026-02-06 12:00:44 +00:00
16 lines
654 B
Bash
Executable File
16 lines
654 B
Bash
Executable File
#!/usr/bin/sh
|
|
set -eo pipefail
|
|
|
|
# This script appends the "option go_package" proto option to the file located at $FNAME.
|
|
# This option is not included in the proto files to allow the files to more easily
|
|
# be hosted in github.com/tendermint/spec and shared between other repos.
|
|
# This option specifies what the package will be named when imported by other packages.
|
|
|
|
FNAME=$1
|
|
MODNAME=$(echo $2| sed 's/\//\\\//g')
|
|
PACKAGE="$(dirname $FNAME | sed 's/^\.\/\(.*\)/\1/g' | sed 's/\//\\\//g')"
|
|
|
|
if ! `grep -q 'option\s\+go_package\s\+=\s\+.*;' $FNAME`; then
|
|
sed -i "s/\(package tendermint.*\)/\1\n\noption go_package = \"$MODNAME\/$PACKAGE\";/g" $FNAME
|
|
fi
|