# deepseek-tray 构建脚本:格式检查 -> 静态检查 -> 单元测试 -> 构建 $ErrorActionPreference = 'Stop' Push-Location $PSScriptRoot try { Write-Host '[1/4] gofmt 检查' $unformatted = gofmt -l . if ($unformatted) { throw ('以下文件未格式化: ' + ($unformatted -join ', ')) } Write-Host '[2/4] go vet' go vet ./... if ($LASTEXITCODE -ne 0) { throw 'go vet 失败' } Write-Host '[3/4] go test' go test ./... if ($LASTEXITCODE -ne 0) { throw 'go test 失败' } Write-Host '[4/4] go build' go build -trimpath -ldflags '-H=windowsgui -s -w' -o deepseek-tray.exe . if ($LASTEXITCODE -ne 0) { throw 'go build 失败' } $size = [math]::Round((Get-Item 'deepseek-tray.exe').Length / 1KB, 0) Write-Host ('构建成功: deepseek-tray.exe (' + $size + ' KB)') } finally { Pop-Location }