Files
runner-images/images/linux/scripts/installers/go.sh
Dmitry Shibanov f06102ac3a Switch provisioners to install Go from GitHub releases on Ubuntu (#1025)
* install go

* added validation

* check zero build version

* add versions and for ubuntu2004

* setup for ubuntu

* fix execute command

* fix issue with cat

* fix go.sh

* fix comments

* remove documentation

* fix comment position go.sh ubuntu2004

* fix version

* remove import

* remove variables

* remove fake url

* fix linking to default version

Co-authored-by: Dmitry Shibanov <v-dmshib@microsoft.com>
2020-06-19 19:29:07 +03:00

26 lines
946 B
Bash

#!/bin/bash
################################################################################
## File: go.sh
## Desc: Installs go, configures GOROOT, and adds go to the path
################################################################################
# Fail out if any setups fail
set -e
toolsetJson="$INSTALLER_SCRIPT_FOLDER/toolset.json"
toolsetVersions=(`ls $AGENT_TOOLSDIRECTORY/go`)
defaultVersion=$(jq -r '.toolcache[] | select(.name | contains("go")) | .default' $toolsetJson)
for toolsetVersion in ${toolsetVersions[@]}
do
major="$(cut -d'.' -f1 <<< "$toolsetVersion")"
minor="$(cut -d'.' -f2 <<< "$toolsetVersion")"
goFolder="$AGENT_TOOLSDIRECTORY/go/$toolsetVersion/x64"
echo "GOROOT_${major}_${minor}_X64=$goFolder" | tee -a /etc/environment
if [[ "$toolsetVersion" =~ $defaultVersion ]]; then
ln -s $goFolder/bin/* /usr/bin/
echo "GOROOT=$goFolder" | tee -a /etc/environment
fi
done