diff --git a/Makefile b/Makefile index ea1bfe3..0686c47 100644 --- a/Makefile +++ b/Makefile @@ -2,6 +2,8 @@ dev_build_version=$(shell git describe --tags --always --dirty) export PATH := $(shell pwd)/.tmp/protoc/bin:$(PATH) +export PROTOC_VERSION := 22.0 + # TODO: run golint and errcheck, but only to catch *new* violations and # decide whether to change code or not (e.g. we need to be able to whitelist # violations already in the code). They can be useful to catch errors, but @@ -88,6 +90,6 @@ errcheck: test: go test -race ./... -.tmp/protoc/bin/protoc: +.tmp/protoc/bin/protoc: ./Makefile ./download_protoc.sh ./download_protoc.sh diff --git a/download_protoc.sh b/download_protoc.sh index 5190003..6bbd135 100755 --- a/download_protoc.sh +++ b/download_protoc.sh @@ -4,7 +4,10 @@ set -e cd $(dirname $0) -PROTOC_VERSION="22.0" +if [[ -z "$PROTOC_VERSION" ]]; then + echo "Set PROTOC_VERSION env var to indicate the version to download" >&2 + exit 1 +fi PROTOC_OS="$(uname -s)" PROTOC_ARCH="$(uname -m)" case "${PROTOC_OS}" in @@ -27,6 +30,6 @@ if [[ "$(${PROTOC} --version 2>/dev/null)" != "libprotoc 3.${PROTOC_VERSION}" ]] rm -rf ./.tmp/protoc mkdir -p .tmp/protoc curl -L "https://github.com/google/protobuf/releases/download/v${PROTOC_VERSION}/protoc-${PROTOC_VERSION}-${PROTOC_OS}-${PROTOC_ARCH}.zip" > .tmp/protoc/protoc.zip - cd ./.tmp/protoc && unzip protoc.zip && cd .. + pushd ./.tmp/protoc && unzip protoc.zip && popd fi