Files
subtrack/build.ps1
T
chun_qiu f047662129
build / build-and-test (push) Failing after 1m24s
首次推送
2026-10-18 19:44:38 +08:00

21 lines
803 B
PowerShell
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# 离线构建脚本:本机无法访问任何 Go 模块源,全部依赖取自本地模块缓存
$ErrorActionPreference = 'Stop'
$root = Split-Path -Parent $MyInvocation.MyCommand.Path
$env:GOFLAGS = '-mod=mod'
$env:GOPROXY = 'off'
$env:GOSUMDB = 'off'
$env:GOCACHE = Join-Path $root '.gocache'
$env:GOTMPDIR = Join-Path $root '.gotmp'
New-Item -ItemType Directory -Force -Path $env:GOCACHE, $env:GOTMPDIR | Out-Null
Push-Location $root
try {
Write-Host '正在编译…' -ForegroundColor Cyan
go build -trimpath -ldflags '-s -w' -o daili.exe .
if ($LASTEXITCODE -ne 0) { throw "编译失败(退出码 $LASTEXITCODE)" }
$f = Get-Item daili.exe
Write-Host ("编译完成: {0} {1:N1} MB" -f $f.Name, ($f.Length / 1MB)) -ForegroundColor Green
} finally {
Pop-Location
}