Merge pull request #11453 from ilya-zuyev/ilyaz/fix_install_go_on_arm

Fix golang installation script for arm64
pull/11465/head
ilya-zuyev 2021-05-19 10:50:46 -07:00 committed by GitHub
commit 4ac50b7415
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 17 additions and 2 deletions

View File

@ -25,7 +25,22 @@ fi
VERSION_TO_INSTALL=${1}
INSTALL_PATH=${2}
ARCH=${ARCH:=amd64}
function current_arch() {
case $(arch) in
"x86_64")
echo "amd64"
;;
"aarch64")
echo "arm64"
;;
*)
echo "unexpected arch: $(arch). use amd64" 1>&2
echo "amd64"
;;
esac
}
ARCH=${ARCH:=$(current_arch)}
# installs or updates golang if right version doesn't exists
function check_and_install_golang() {
@ -62,7 +77,7 @@ function install_golang() {
# using sudo because previously installed versions might have been installed by a different user.
# as it was the case on jenkins VM.
sudo curl -qL -O "https://storage.googleapis.com/golang/go${1}.${INSTALLOS}-${ARCH}.tar.gz" &&
sudo tar -xzf go${1}.${INSTALLOS}-amd64.tar.gz &&
sudo tar -xzf go${1}.${INSTALLOS}-${ARCH}.tar.gz &&
sudo rm -rf "${2}/go" &&
sudo mv go "${2}/" && sudo chown -R $(whoami): ${2}/go
popd >/dev/null