From 29a69c2091015d9d528b2177145c755f65de8e3e Mon Sep 17 00:00:00 2001 From: zepatrik Date: Mon, 23 Nov 2020 13:27:23 +0100 Subject: [PATCH] feat: add go-grpc plugin --- scripts/executor-info.sh | 1 + scripts/install-go-grpc-plugin.sh | 14 ++++++++++++++ scripts/install-go-plugin.sh | 1 + 3 files changed, 16 insertions(+) create mode 100644 scripts/install-go-grpc-plugin.sh diff --git a/scripts/executor-info.sh b/scripts/executor-info.sh index 05ffe59..9bcfb99 100755 --- a/scripts/executor-info.sh +++ b/scripts/executor-info.sh @@ -1,4 +1,5 @@ #!/bin/bash +set -euo pipefail UNAME_OS=$(uname -s) UNAME_ARCH=$(uname -m) diff --git a/scripts/install-go-grpc-plugin.sh b/scripts/install-go-grpc-plugin.sh new file mode 100644 index 0000000..01f9576 --- /dev/null +++ b/scripts/install-go-grpc-plugin.sh @@ -0,0 +1,14 @@ +#!/bin/bash +set -euo pipefail + +source scripts/executor-info.sh + +PLUGIN_VERSION=$1 + +if [ ! -f ".bin/protoc-gen-go-grpc" ] || .bin/protoc-gen-go-grpc --version | grep -q "$PLUGIN_VERSION"; then + echo "Installing protobuf-gen-go-grpc $PLUGIN_VERSION for OS $UNAME_OS Arch $UNAME_ARCH" + mkdir -p .bin + curl --fail -sSL "https://github.com/grpc/grpc-go/releases/download/cmd%2Fprotoc-gen-go-grpc%2F$PLUGIN_VERSION/protoc-gen-go-grpc.$PLUGIN_VERSION.$NORMALIZED_OS.$NORMALIZED_ARCH.tar.gz" -o .bin/protoc-gen-go-grpc.tar.gz + tar -xf .bin/protoc-gen-go-grpc.tar.gz -C .bin + chmod +x .bin/protoc-gen-go-grpc +fi diff --git a/scripts/install-go-plugin.sh b/scripts/install-go-plugin.sh index 3d2f08b..0a38dd0 100755 --- a/scripts/install-go-plugin.sh +++ b/scripts/install-go-plugin.sh @@ -1,4 +1,5 @@ #!/bin/bash +set -euo pipefail source scripts/executor-info.sh