8if [ -z "${BASH_VERSINFO}" ] || [ -z "${BASH_VERSINFO[0]}" ] || [ ${BASH_VERSINFO[0]} -lt 4 ]; then
9 echo "This script requires Bash version >= 4"; exit 1;
18 desired[go]="${arg##*=}"
21 printf "${GREEN}$0${NC}\n"
22 printf " available options:\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.12
94 echo "$GO_VERSION < 1.12"
98 VERSION=$(${tools[go]} version | ${tools[awk]} '{print $3}')
99 tools["go_version"]="${VERSION}"
102check_docker_version() {
103 echo -n "Checking docker version... "
104 DOCKER_VERSION=$(${tools[docker]} version | ${tools[awk]})
108 echo -n "Checking \$GOPATH... "
109 GOPATH="$(go env GOPATH)"
110 if [ -z "$GOPATH" ]; then
111 printf "${RED}invalid${NC} - GOPATH not set\n"
114 printf "${GREEN}valid${NC} - $GOPATH\n"
126check_for golangci-lint
131 MAKE := "${tools[make]}"
133 GO_VERSION := ${tools[go_version]}
134 GOLANGCILINT := "${tools[golangci-lint]}"
137echo "Environment configuration written to .env"
keysesc to close
- j k
- move down, up
- enter
- open
- esc
- back, or up a level
- 1 2 3 4
- readme, files, commits, refs
- /
- filter
- y
- copy the clone command
- c
- compare the chosen commit with another (or shift-click both)
- ?
- show or hide this list