$ErrorActionPreference = "Stop"
$env:CGO_ENABLED = "0"
$env:GOOS = "windows"
$env:GOARCH = if ($env:PROCESSOR_ARCHITECTURE -eq "ARM64") { "arm64" } else { "amd64" }

New-Item -ItemType Directory -Force -Path dist | Out-Null
go test -buildvcs=false ./...
go build -buildvcs=false -trimpath -ldflags="-s -w" -o dist/fancywin.exe ./cmd/fancywin
Copy-Item fancywin.example.yaml dist/fancywin.yaml

Write-Host "Built dist/fancywin.exe for windows/$env:GOARCH"
