@@ -49,9 +49,9 @@ set -o pipefail
4949
5050[[ ${GIMME_DEBUG} ]] && set -x
5151
52- GIMME_VERSION=" v1.1 .0"
52+ GIMME_VERSION=" v1.2 .0"
5353GIMME_COPYRIGHT=" Copyright (c) 2016 Dan Buch, Tianon Gravi, Travis CI GmbH"
54- GIMME_LICENSE_URL=" https://raw.githubusercontent.com/travis-ci/gimme/v1.1 .0/LICENSE"
54+ GIMME_LICENSE_URL=" https://raw.githubusercontent.com/travis-ci/gimme/v1.2 .0/LICENSE"
5555export GIMME_VERSION
5656export GIMME_COPYRIGHT
5757export GIMME_LICENSE_URL
@@ -101,7 +101,7 @@ _binary() {
101101 urls=(
102102 " ${GIMME_DOWNLOAD_BASE} /go${version} .${GIMME_OS} -${arch} .tar.gz"
103103 )
104- if [[ " ${GIMME_OS} " = ' darwin' && " ${GIMME_BINARY_OSX} " ]]; then
104+ if [[ " ${GIMME_OS} " == ' darwin' && " ${GIMME_BINARY_OSX} " ]]; then
105105 urls=(
106106 " ${GIMME_DOWNLOAD_BASE} /go${version} .${GIMME_OS} -${arch} -${GIMME_BINARY_OSX} .tar.gz"
107107 " ${urls[@]} "
@@ -155,8 +155,8 @@ _checkout() {
155155 git reset -q --hard " origin/${1} " \
156156 || git reset -q --hard " origin/go${1} " \
157157 || { [ " ${1} " = ' tip' ] && git reset -q --hard origin/master; } \
158- || git reset -q --hard " refs/tags/${1} " \
159- || git reset -q --hard " refs/tags/go${1} "
158+ || git reset -q --hard " refs/tags/${1} " \
159+ || git reset -q --hard " refs/tags/go${1} "
160160 } 2> /dev/null)
161161}
162162
@@ -253,12 +253,12 @@ _env() {
253253 # Tools like `gimme` are the reason that GOROOT-in-env exists.
254254
255255 echo
256- if [[ " $( GOROOT=" ${1} " " ${1} /bin/go" env GOHOSTOS) " = " ${GIMME_OS} " ]]; then
256+ if [[ " $( GOROOT=" ${1} " " ${1} /bin/go" env GOHOSTOS) " == " ${GIMME_OS} " ]]; then
257257 echo ' unset GOOS;'
258258 else
259259 echo ' export GOOS="' " ${GIMME_OS} " ' ";'
260260 fi
261- if [[ " $( GOROOT=" ${1} " " ${1} /bin/go" env GOHOSTARCH) " = " ${GIMME_ARCH} " ]]; then
261+ if [[ " $( GOROOT=" ${1} " " ${1} /bin/go" env GOHOSTARCH) " == " ${GIMME_ARCH} " ]]; then
262262 echo ' unset GOARCH;'
263263 else
264264 echo ' export GOARCH="' " ${GIMME_ARCH} " ' ";'
@@ -281,7 +281,7 @@ _env_alias() {
281281 return
282282 fi
283283
284- if [[ " $( GOROOT=" ${1} " " ${1} /bin/go" env GOHOSTOS) " = " ${GIMME_OS} " && " $( GOROOT=" ${1} " " ${1} /bin/go" env GOHOSTARCH) " = " ${GIMME_ARCH} " ]]; then
284+ if [[ " $( GOROOT=" ${1} " " ${1} /bin/go" env GOHOSTOS) " == " ${GIMME_OS} " && " $( GOROOT=" ${1} " " ${1} /bin/go" env GOHOSTARCH) " = = " ${GIMME_ARCH} " ]]; then
285285 local dest=" ${GIMME_ENV_PREFIX} /go${GIMME_GO_VERSION} .env"
286286 cp " ${2} " " ${dest} "
287287 ln -sf " ${dest} " " ${GIMME_ENV_PREFIX} /latest.env"
@@ -390,7 +390,7 @@ _list_versions() {
390390 local cleaned=" ${d##*/ go} "
391391 cleaned=" ${cleaned%% .${GIMME_OS} .* } "
392392 echo -en " ${cleaned} "
393- if [[ " ${cleaned} " = " ${current_version} " ]]; then
393+ if [[ " ${cleaned} " == " ${current_version} " ]]; then
394394 echo -en ' <= current' >&2
395395 fi
396396 echo
@@ -423,8 +423,12 @@ _realpath() {
423423
424424_get_curr_stable () {
425425 local stable=" ${GIMME_VERSION_PREFIX} /stable"
426+ local now_secs
427+ now_secs=" $( date +%s) "
428+ local stable_age
429+ stable_age=" $( _stat_unix " ${stable} " 2> /dev/null || echo 0) "
426430 local age
427- age=$(( $(date +% s) - $(_stat_unix " ${stable} " 2 >/ dev / null || echo 0 ) ) )
431+ age=$(( now_secs - stable_age ))
428432
429433 if [[ " ${age} " -gt 86400 ]]; then
430434 _update_stable " ${stable} "
@@ -610,7 +614,7 @@ case "${GIMME_ARCH}" in
610614 echo >&2 " try go1.5 or newer"
611615 exit 1
612616 fi
613- if [[ " ${GIMME_HOSTOS} " = " linux" && " ${GIMME_HOSTARCH} " != " ${GIMME_ARCH} " ]]; then
617+ if [[ " ${GIMME_HOSTOS} " == " linux" && " ${GIMME_HOSTARCH} " != " ${GIMME_ARCH} " ]]; then
614618 : " ${GIMME_CC_FOR_TARGET:= " aarch64-linux-gnu-gcc" } "
615619 fi
616620 ;;
0 commit comments