From 04f6feb32b9330d459031650c32c1bc9f7d5f0d6 Mon Sep 17 00:00:00 2001 From: William Banfield Date: Fri, 12 Nov 2021 12:36:37 -0500 Subject: [PATCH] protopackage fixes --- scripts/protopackage.sh | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/scripts/protopackage.sh b/scripts/protopackage.sh index 1f9ba4e83..da3fcf158 100755 --- a/scripts/protopackage.sh +++ b/scripts/protopackage.sh @@ -1,5 +1,5 @@ #!/usr/bin/sh -set -eo pipefail +set -euo pipefail # This script appends the "option go_package" proto option to the file located at $FNAME. # This option specifies what the package will be named when imported by other packages. @@ -8,7 +8,7 @@ set -eo pipefail # If the option is already specified in the file, it will be replaced using the # arguments passed to this script. -FNAME=$1 +FNAME="${1:?missing required .proto filename}" MODNAME=$(echo $2| sed 's/\//\\\//g') PACKAGE="$(dirname $FNAME | sed 's/^\.\/\(.*\)/\1/g' | sed 's/\//\\\//g')" if [[ ! -z "$3" ]]; then @@ -16,7 +16,7 @@ if [[ ! -z "$3" ]]; then fi -if ! `grep -q 'option\s\+go_package\s\+=\s\+.*;' $FNAME`; then +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 else sed -i "s/option\s\+go_package\s\+=\s\+.*;/option go_package = \"$MODNAME\/$PACKAGE\";/g" $FNAME