Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
47 changes: 1 addition & 46 deletions libexec/goenv-install
Original file line number Diff line number Diff line change
Expand Up @@ -43,53 +43,8 @@ if [ "$platform" = "darwin" ]; then
fi
fi




function vercomp () {
# http://stackoverflow.com/questions/4023830
# 0: '='
# 1: '>'
# 2: '<'
if [[ $1 == $2 ]]
then
echo 0
fi
local IFS=.
local i ver1=($1) ver2=($2)
# fill empty fields in ver1 with zeros
for ((i=${#ver1[@]}; i<${#ver2[@]}; i++))
do
ver1[i]=0
done
for ((i=0; i<${#ver1[@]}; i++))
do
if [[ -z ${ver2[i]} ]]
then
# fill empty fields in ver2 with zeros
ver2[i]=0
fi
if ((10#${ver1[i]} > 10#${ver2[i]}))
then
echo 1
fi
if ((10#${ver1[i]} < 10#${ver2[i]}))
then
echo 2
fi
done
# echo 0
}


rtn=$(vercomp ${version} 1.2)
# URL to download from
if [ "$rtn" == "1" ]
then
download="http://golang.org/dl/go${version}.${platform}-${arch}${extra}.tar.gz"
else
download="https://go.googlecode.com/files/go${version}.${platform}-${arch}${extra}.tar.gz"
fi
download="http://golang.org/dl/go${version}.${platform}-${arch}${extra}.tar.gz"
# Can't get too clever here
set +e

Expand Down