2022-11-03 13:54:49 +00:00
|
|
|
#!/bin/sh
|
|
|
|
|
set -eu
|
2023-03-01 18:47:52 +00:00
|
|
|
|
|
|
|
|
REQUIRED_GO_MINOR=$(sed -En 's/^go[[:space:]]+([[:digit:].]+)$/\1/p' go.mod)
|
|
|
|
|
ACTUAL_GO_VERSION=$(go version | sed -n 's/^go version go\([0-9]*\.[0-9]*\.[0-9]*\)\(.*\)/\1/p')
|
|
|
|
|
|
|
|
|
|
# We use 'case' instead of '[' to match values against complex patterns, because POSIX
|
|
|
|
|
# does not guarantee that '[' supports advanced features like globs and regex.
|
|
|
|
|
if case "$ACTUAL_GO_VERSION" in "$REQUIRED_GO_MINOR".*) false ;; *) true ;; esac then
|
|
|
|
|
red="\e[0;91m"
|
|
|
|
|
reset="\e[0m"
|
|
|
|
|
|
|
|
|
|
printf "${red}PROBLEM: You need go %s to build d2, but you have %s installed.${reset}\n" "$REQUIRED_GO_MINOR" "$ACTUAL_GO_VERSION"
|
|
|
|
|
exit 1
|
|
|
|
|
fi
|
|
|
|
|
|
2022-12-01 14:49:48 +00:00
|
|
|
if [ ! -e "$(dirname "$0")/ci/sub/.git" ]; then
|
|
|
|
|
set -x
|
2022-11-29 21:54:11 +00:00
|
|
|
git submodule update --init
|
2022-12-01 14:49:48 +00:00
|
|
|
set +x
|
2022-11-29 21:54:11 +00:00
|
|
|
fi
|
2022-11-03 13:54:49 +00:00
|
|
|
. "$(dirname "$0")/ci/sub/lib.sh"
|
|
|
|
|
PATH="$(cd -- "$(dirname "$0")" && pwd)/ci/sub/bin:$PATH"
|
2022-12-18 20:41:22 +00:00
|
|
|
cd -- "$(dirname "$0")"
|
2022-11-03 13:54:49 +00:00
|
|
|
|
|
|
|
|
_make "$@"
|