mirror of
https://github.com/actions/runner-images-sangeeth.git
synced 2025-12-23 18:08:53 +08:00
* add go to json toolset * add install and validate go * fiixing go tests * fix validation for go * check zero build version * add 1.9 version * setup variables for go * fix comments * remove script invokation * remove lines * fixing install go * remove comments * remove fake url Co-authored-by: Dmitry Shibanov <v-dmshib@microsoft.com>
25 lines
1.0 KiB
PowerShell
25 lines
1.0 KiB
PowerShell
################################################################################
|
|
## File: Install-Go.ps1
|
|
## Desc: Install Go
|
|
################################################################################
|
|
|
|
Import-Module -Name ImageHelpers -Force -DisableNameChecking
|
|
|
|
# Get Go content from toolset
|
|
$goTool = Get-ToolsetContent | Select-Object -ExpandProperty toolcache | Where-Object Name -eq "go"
|
|
|
|
$toolPath = Join-Path $env:AGENT_TOOLSDIRECTORY $goTool.name
|
|
foreach($goVersion in $goTool.versions)
|
|
{
|
|
if ($goVersion.Split(".").Length -lt 3) {
|
|
$goVersion += ".*"
|
|
}
|
|
$expectedVersionPath = Join-Path $toolPath $goVersion
|
|
$foundVersion = Get-Item $expectedVersionPath `
|
|
| Sort-Object -Property {[version]$_.name} -Descending `
|
|
| Select-Object -First 1
|
|
# Check for required architecture folder
|
|
$foundVersionArchPath = Join-Path $foundVersion $goTool.arch
|
|
$envName = "GOROOT_{0}_{1}_X64" -f $goVersion.split(".")
|
|
setx $envName "$foundVersionArchPath" /M
|
|
} |