From 5d6406a695be92d47ed000e934c86224cf9a1135 Mon Sep 17 00:00:00 2001 From: Alex Tomlins Date: Fri, 5 Sep 2014 15:50:36 +0100 Subject: [PATCH] Fix goenv install for 1.3.1 There was a problem with the vercomp function that caused it to echo more than once for some comparisons. This would appear to be a side effect of changing the stackoverflow function to echo instead of using return value. Comparing 1.2 and 1.3.1 is one of the cases that was echoing more than once. This then caused the test for `"$rtn" == "1"` to be false, which meant that it was trying to use the old source URL. --- libexec/goenv-install | 3 +++ 1 file changed, 3 insertions(+) diff --git a/libexec/goenv-install b/libexec/goenv-install index 486a5e3..f7c48a7 100755 --- a/libexec/goenv-install +++ b/libexec/goenv-install @@ -54,6 +54,7 @@ function vercomp () { if [[ $1 == $2 ]] then echo 0 + return fi local IFS=. local i ver1=($1) ver2=($2) @@ -72,10 +73,12 @@ function vercomp () { if ((10#${ver1[i]} > 10#${ver2[i]})) then echo 1 + return fi if ((10#${ver1[i]} < 10#${ver2[i]})) then echo 2 + return fi done # echo 0