install-go-msi.ps1 460 B

123456789101112131415161718192021
  1. $ErrorActionPreference = "Stop"
  2. $ProgressPreference = "SilentlyContinue"
  3. $GoMsiVersion = "go1.22.5.windows-amd64.msi"
  4. Write-Output "Downloading go installer..."
  5. Set-Location "$Env:Temp"
  6. (New-Object System.Net.WebClient).DownloadFile(
  7. "https://go.dev/dl/$GoMsiVersion",
  8. "$Env:Temp\$GoMsiVersion"
  9. )
  10. Write-Output "Installing go..."
  11. Install-Package "$Env:Temp\$GoMsiVersion" -Force
  12. # Go installer updates global $PATH
  13. go env
  14. Write-Output "Installed"