Optimize linting and unit tests in build.ps1
@@ -152,26 +152,24 @@ function linter_commands
echo "Linting failed..."
exit 1
}
+
+ errcheck $(go list ./... | Select-String -pattern "dashboardd", "cli/commands/importer", "agent/assetmanager" -notMatch)
+ If ($LASTEXITCODE -ne 0) {
+ echo "Linting failed..."
+ exit 1
+ }
}
function test_commands
{
echo "Running tests..."
- $failed = 0
- echo "" > "coverage.txt"
- $packages = go list ./... | Select-String -pattern "testing", "vendor" -notMatch
- ForEach ($pkg in $packages) {
- go test -timeout=60s -v -coverprofile="profile.out" -covermode=atomic $pkg
+
+ go test -timeout=60s -v $(go list ./... | Select-String -pattern "testing", "vendor" -notMatch)
If ($LASTEXITCODE -ne 0) {
echo "Testing failed..."
exit 1
}
- If (Test-Path "profile.out") {
- cat "profile.out" >> "coverage.txt"
- rm "profile.out"
- }
- }
}
function e2e_commands
