Files
EvoBGP/scripts/lint-go.ps1
T
DenozordecandCursor f8e0520817 feat(httpapi): harden control plane and speed up prefix refresh
Очередь job получила lease и fencing, телеметрия и прогресс deploy сохраняются, ревизия пишет manifest входов. Обновление префиксов не переписывает неизменённый снимок, большие наборы идут через COPY, а устаревшая ревизия не попадает в deploy. Бандл ноды кэшируется, prune и постановка job больше не держат горячий путь.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-11-02 17:23:59 +07:00

34 lines
1.2 KiB
PowerShell

# Same gates as CI job go (subset): gofmt, vet, golangci-lint.
$ErrorActionPreference = 'Stop'
Set-Location (Join-Path $PSScriptRoot '..')
# Enumerate packages in this module instead of recursively formatting unrelated
# checkouts such as .claude/worktrees. Include tagged tests in each package dir.
$packageDirs = @(go list -f '{{.Dir}}' ./...)
if ($LASTEXITCODE -ne 0) { exit $LASTEXITCODE }
$unfmt = @(
foreach ($packageDir in ($packageDirs | Sort-Object -Unique)) {
$sourceFiles = @(Get-ChildItem -LiteralPath $packageDir -File -Filter '*.go' | Select-Object -ExpandProperty FullName)
if ($sourceFiles.Count -gt 0) {
gofmt -l @sourceFiles
if ($LASTEXITCODE -ne 0) { exit $LASTEXITCODE }
}
}
)
if ($unfmt) {
Write-Error "gofmt: unformatted files:`n$unfmt"
}
go vet ./...
if ($LASTEXITCODE -ne 0) { exit $LASTEXITCODE }
$golangci = Get-Command golangci-lint -ErrorAction SilentlyContinue
if (-not $golangci) {
$golangciPath = Join-Path $env:USERPROFILE 'go\bin\golangci-lint.exe'
if (Test-Path $golangciPath) { $golangci = @{ Source = $golangciPath } }
}
if ($golangci) {
& $golangci.Source run
if ($LASTEXITCODE -ne 0) { exit $LASTEXITCODE }
} else {
Write-Warning 'lint-go: golangci-lint not found, skipping (CI will run it)'
}