mirror of
https://github.com/actions/runner-images.git
synced 2025-12-14 22:05:17 +00:00
* 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>
26 lines
946 B
Bash
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 |