Aligns go protoc toolset

This commit is contained in:
riccardom
2026-05-18 11:34:01 +02:00
parent 705f87fc20
commit e1b686420a
7 changed files with 103 additions and 15 deletions

View File

@@ -1,2 +1,28 @@
#!/bin/bash
protoc -I testprotos/ testprotos/testproto.proto --go_out=.
set -e
if ! which realpath > /dev/null 2>&1
then
echo realpath is not installed
echo run: brew install coreutils
exit 1
fi
old_pwd=$(pwd)
script_path=$(dirname "$(realpath "$0")")
cd "$script_path/.."
repo_root=$(git rev-parse --show-toplevel)
# shellcheck source=/dev/null
. "$repo_root/proto-tools.env"
actual_protoc=$(protoc --version | awk '{print $2}')
if [ "$actual_protoc" != "$PROTOC_VERSION" ]; then
echo "ERROR: protoc version $actual_protoc differs from pinned $PROTOC_VERSION" >&2
echo "Install protoc $PROTOC_VERSION from https://github.com/protocolbuffers/protobuf/releases" >&2
exit 1
fi
go install "google.golang.org/protobuf/cmd/protoc-gen-go@${PROTOC_GEN_GO_VERSION}"
protoc -I testprotos/ testprotos/testproto.proto --go_out=.
cd "$old_pwd"