Install Go to hostedtoolcache directory on Windows image (#849)

* Move installed go versions to toolcache directory
This commit is contained in:
Vladimir Safonkin
2020-05-11 19:46:36 +03:00
committed by GitHub
parent fad0a6e41d
commit a456ede464
2 changed files with 18 additions and 14 deletions

View File

@@ -11,9 +11,9 @@ function Get-GoVersion
[String]$goVersion
)
Write-Host "Check if $goVersion is presented in the system"
$DestinationPath = "$($env:SystemDrive)\"
$goDirectory = Get-ChildItem -Path $DestinationPath -Filter "Go$goVersion*" | Select-Object -First 1
$goPath = Join-Path $env:SystemDrive $goDirectory
$destinationPath = "$($env:AGENT_TOOLSDIRECTORY)\go"
$goDirectory = Get-ChildItem -Path $destinationPath -Filter "$goVersion*" | Select-Object -First 1
$goPath = Join-Path $destinationPath "$goDirectory\x64"
$env:Path = "$goPath\bin;" + $env:Path
$version = $(go version)