Skip to content

Commit

Permalink
update code coverage script
Browse files Browse the repository at this point in the history
  • Loading branch information
Yusuf Kanchwala committed Jul 26, 2020
1 parent b22944e commit f5c9cbf
Showing 1 changed file with 5 additions and 12 deletions.
17 changes: 5 additions & 12 deletions scripts/generate-coverage.sh
@@ -1,15 +1,8 @@
#!/bin/bash

# source: https://github.com/codecov/example-go
# go test can't generate code coverage for multiple packages in one command
set -o errexit
set -o nounset
set -o pipefail

set -e
touch coverage.out
go test -i -race ./cmd/terrascan
for d in $(go list ./... | grep -v vendor | grep -v tests | grep -v integration_test); do
go test -race -coverprofile=profile.out -covermode=atomic $d
if [ -f profile.out ]; then
cat profile.out >> coverage.out
rm profile.out
fi
done
go test -v -coverpkg=./... -coverprofile=coverage.out ./...
go tool cover -func coverage.out

0 comments on commit f5c9cbf

Please sign in to comment.