[macOS] Add GOROOT env variables (#4220)

This commit is contained in:
Nikita Bykov
2021-10-14 14:42:34 +03:00
committed by GitHub
parent 3ec2449ade
commit 64937b9944
13 changed files with 155 additions and 18 deletions

View File

@@ -28,9 +28,20 @@ function Get-ToolcacheNodeVersions {
return Get-ChildItem $toolcachePath -Name | Sort-Object { [Version]$_ }
}
function Get-ToolcacheGoVersions {
$toolcachePath = Join-Path $env:HOME "hostedtoolcache" "Go"
return Get-ChildItem $toolcachePath -Name | Sort-Object { [Version]$_ }
function Get-ToolcacheGoTable {
$ToolInstances = Get-CachedToolInstances -Name "Go" -VersionCommand "version"
foreach ($Instance in $ToolInstances) {
$Version = [System.Version]($Instance.Version -Split(" "))[0]
$Instance."Environment Variable" = "GOROOT_$($Version.major)_$($Version.minor)_X64"
}
$Content = $ToolInstances | New-MDTable -Columns ([ordered]@{
Version = "left";
Architecture = "left";
"Environment Variable" = "left"
})
return $Content
}
function Build-ToolcacheSection {
@@ -47,7 +58,7 @@ function Build-ToolcacheSection {
$output += New-MDHeader "Node.js" -Level 4
$output += New-MDList -Lines (Get-ToolcacheNodeVersions) -Style Unordered
$output += New-MDHeader "Go" -Level 4
$output += New-MDList -Lines (Get-ToolcacheGoVersions) -Style Unordered
$output += Get-ToolcacheGoTable
}
return $output