@@ -9,7 +9,7 @@ usage() {
99$this : download go binaries for alecthomas/gometalinter
1010
1111Usage: $this [-b] bindir [-d] [tag]
12- -b sets bindir or installation directory, Defaults to ./bin
12+ -b sets bindir or installation directory. If not provided, checks for GOPATH bin. Otherwise defaults to ./bin
1313 -d turns on debug logging
1414 [tag] is a tag from
1515 https://github.com/alecthomas/gometalinter/releases
2323}
2424
2525parse_args () {
26- # BINDIR is ./bin unless set be ENV
26+ # BINDIR is ./bin unless set be ENV or GOPATH is not set
2727 # over-ridden by flag below
2828
29+ test -n " $GOPATH " && BINDIR=" ${GOPATH} /bin"
30+
2931 BINDIR=${BINDIR:- ./ bin}
3032 while getopts " b:dh?" arg; do
3133 case " $arg " in
@@ -97,8 +99,8 @@ tag_to_version() {
9799 VERSION=${TAG# v}
98100}
99101adjust_format () {
100- # change format (tar.gz or zip) based on ARCH
101- case ${ARCH } in
102+ # change format (tar.gz or zip) based on OS
103+ case ${OS } in
102104 windows) FORMAT=zip ;;
103105 esac
104106 true
@@ -172,7 +174,7 @@ log_crit() {
172174uname_os () {
173175 os=$( uname -s | tr ' [:upper:]' ' [:lower:]' )
174176 case " $os " in
175- msys_nt) os=" windows" ;;
177+ msys_nt* ) os=" windows" ;;
176178 esac
177179 echo " $os "
178180}
@@ -356,7 +358,7 @@ PREFIX="$OWNER/$REPO"
356358
357359# use in logging routines
358360log_prefix () {
359- echo " $PREFIX "
361+ echo " $PREFIX "
360362}
361363PLATFORM=" ${OS} /${ARCH} "
362364GITHUB_DOWNLOAD=https://github.com/${OWNER} /${REPO} /releases/download
0 commit comments