Fix: install Go 1.26.3 directly, use GOTOOLCHAIN=local (no runtime download)
This commit is contained in:
+25
-13
@@ -42,37 +42,49 @@ function Download-File($url, $dest) {
|
||||
}
|
||||
|
||||
# 1. Go pruefen / als ZIP installieren (kein MSI = kein Exit 1603)
|
||||
Write-Host "[1/3] Pruefe Go..."
|
||||
$goRoot = "C:\Go"
|
||||
$goExe = "$goRoot\bin\go.exe"
|
||||
# upterm benoetigt Go >= 1.26 - direkt richtige Version installieren
|
||||
Write-Host "[1/3] Pruefe Go (benoetigt >= 1.26)..."
|
||||
$goRoot = "C:\Go"
|
||||
$goExe = "$goRoot\bin\go.exe"
|
||||
$goVersion = "1.26.3"
|
||||
|
||||
if (-not (Test-Path $goExe)) {
|
||||
$goVersion = "1.22.4"
|
||||
$goZip = "C:\Windows\Temp\go-windows.zip"
|
||||
$goUrl = "https://golang.org/dl/go$goVersion.windows-amd64.zip"
|
||||
$needsInstall = $true
|
||||
if (Test-Path $goExe) {
|
||||
$verLine = (& $goExe version 2>&1).ToString()
|
||||
if ($verLine -match 'go(\d+)\.(\d+)') {
|
||||
$major = [int]$Matches[1]; $minor = [int]$Matches[2]
|
||||
if ($major -gt 1 -or ($major -eq 1 -and $minor -ge 26)) {
|
||||
$needsInstall = $false
|
||||
Write-Host " OK ($verLine)"
|
||||
} else {
|
||||
Write-Host " Go $major.$minor zu alt - aktualisiere auf $goVersion..."
|
||||
Remove-Item -Recurse -Force $goRoot -ErrorAction SilentlyContinue
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Write-Host " Go nicht gefunden - lade go$goVersion (ZIP) herunter..."
|
||||
if ($needsInstall) {
|
||||
$goZip = "C:\Windows\Temp\go-windows.zip"
|
||||
$goUrl = "https://golang.org/dl/go$goVersion.windows-amd64.zip"
|
||||
Write-Host " Lade go$goVersion (ZIP) herunter..."
|
||||
if (-not (Download-File $goUrl $goZip)) {
|
||||
Read-Host "Enter zum Beenden"; exit 1
|
||||
}
|
||||
|
||||
Write-Host " Entpacke nach $goRoot ..."
|
||||
if (Test-Path $goRoot) { Remove-Item -Recurse -Force $goRoot }
|
||||
Expand-Archive -Path $goZip -DestinationPath "C:\" -Force
|
||||
Remove-Item $goZip -ErrorAction SilentlyContinue
|
||||
|
||||
if (-not (Test-Path $goExe)) {
|
||||
Write-Host "FEHLER: go.exe nach Entpacken nicht gefunden."
|
||||
Read-Host "Enter zum Beenden"; exit 1
|
||||
}
|
||||
Write-Host " OK (go$goVersion installiert)"
|
||||
}
|
||||
|
||||
# Go in PATH dieser Session
|
||||
if ($env:PATH -notlike "*$goRoot\bin*") {
|
||||
$env:PATH = "$env:PATH;$goRoot\bin"
|
||||
}
|
||||
$goVer = & $goExe version 2>&1
|
||||
Write-Host " OK ($goVer)"
|
||||
|
||||
# 2. upterm bauen via Quellcode-ZIP
|
||||
# (go install erlaubt keine replace-Direktiven in externen Modulen)
|
||||
@@ -104,7 +116,7 @@ $env:TMP = "C:\GoTemp"
|
||||
$env:GOCACHE = "C:\GoCache"
|
||||
$env:GOTMPDIR = "C:\GoTemp"
|
||||
Push-Location $repoDir
|
||||
$env:GOTOOLCHAIN = "auto"
|
||||
$env:GOTOOLCHAIN = "local"
|
||||
& $goExe build -o "$env:GOPATH\bin\upterm.exe" ./cmd/upterm 2>&1 | ForEach-Object { Write-Host " $_" }
|
||||
$buildExit = $LASTEXITCODE
|
||||
Pop-Location
|
||||
|
||||
Reference in New Issue
Block a user