Files
full/scripts/verify-workspace.ps1

35 lines
863 B
PowerShell
Raw Normal View History

2026-08-10 11:42:45 +08:00
[CmdletBinding()]
param(
[switch]$SkipVet
)
$ErrorActionPreference = "Stop"
$workspaceRoot = Split-Path -Parent $PSScriptRoot
Push-Location $workspaceRoot
try {
$unformatted = @(gofmt -l all module)
if ($unformatted.Count -gt 0) {
throw ("gofmt required:" + [Environment]::NewLine + ($unformatted -join [Environment]::NewLine))
}
$modules = @(go list -m -f '{{.Dir}}')
foreach ($module in $modules) {
Write-Host "==> $module"
Push-Location $module
try {
if (-not $SkipVet) {
go vet ./...
if ($LASTEXITCODE -ne 0) { throw "go vet failed: $module" }
}
go test ./...
if ($LASTEXITCODE -ne 0) { throw "go test failed: $module" }
}
finally {
Pop-Location
}
}
}
finally {
Pop-Location
}