Files
MeBox/scripts/build-protected.ps1
T
2026-06-25 14:46:28 +08:00

21 lines
605 B
PowerShell
Vendored

param(
[string]$Output = "bin/mediastation-go-protected.exe",
[switch]$Garble
)
$ErrorActionPreference = "Stop"
$env:CGO_ENABLED = "0"
New-Item -ItemType Directory -Force -Path (Split-Path -Parent $Output) | Out-Null
if ($Garble) {
if (-not (Get-Command garble -ErrorAction SilentlyContinue)) {
throw "garble is not installed. Run: go install mvdan.cc/garble@latest"
}
garble -literals -tiny build -trimpath -ldflags="-s -w -buildid=" -o $Output ./cmd/server
exit $LASTEXITCODE
}
go build -trimpath -buildvcs=false -ldflags="-s -w -buildid=" -o $Output ./cmd/server
exit $LASTEXITCODE