@@ -0,0 +1,137 @@
14+ desired[go]="${arg##*=}"
17+ desired[dep]="${arg##*=}"
20+ printf "${GREEN}$0${NC}\n"
21+ printf " available options:\n"
22+ printf " --with-dep=${BLUE}<path_to_dep_binary>${NC}\n"
23+ printf " --with-go=${BLUE}<path_to_go_binary>${NC}\n"
27+ echo "Unknown option: $arg"
39+ local i ver1=($1) ver2=($2)
40+ # fill empty fields in ver1 with zeros
41+ for ((i=${#ver1[@]}; i<${#ver2[@]}; i++))
45+ for ((i=0; i<${#ver1[@]}; i++))
47+ if [[ -z ${ver2[i]} ]]
49+ # fill empty fields in ver2 with zeros
52+ if ((10#${ver1[i]} > 10#${ver2[i]}))
56+ if ((10#${ver1[i]} < 10#${ver2[i]}))
65+ echo -n "Checking for $1... "
66+ if ! [ -z "${desired[$1]}" ]; then
67+ TOOL_PATH="${desired[$1]}"
69+ TOOL_PATH=$(command -v $1)
71+ if ! [ -x "$TOOL_PATH" -a -f "$TOOL_PATH" ]; then
72+ printf "${RED}not found${NC}\n"
76+ printf "${GREEN}found${NC}\n"
82+ echo -n "Checking go version... "
83+ GO_VERSION=$(${tools[go]} version | ${tools[awk]} '{where = match($0, /[0-9]\.[0-9]+\.[0-9]*/); if (where != 0) print substr($0, RSTART, RLENGTH)}')
84+ vercomp $GO_VERSION 1.10
94+ echo "$GO_VERSION < 1.10"
100+check_docker_version() {
101+ echo -n "Checking docker version... "
102+ DOCKER_VERSION=$(${tools[docker]} version | ${tools[awk]})
106+ echo -n "Checking \$GOPATH... "
107+ if [ -z "$GOPATH" ]; then
108+ printf "${RED}invalid${NC} - GOPATH not set\n"
111+ printf "${GREEN}valid${NC} - $GOPATH\n"
116+if [ ! -f .env ]; then
130+ MAKE := "${tools[make]}"
131+ GO := "${tools[go]}"
132+ DEP := "${tools[dep]}"
135+echo "Environment configuration written to .env"