Skip to content

Commit 586f9a0

Browse files
committed
build: display coverage using go tool cover
1 parent b6f8cac commit 586f9a0

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

Makefile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,8 +51,8 @@ test-coverage: ; $(info $(M) running coverage tests…) @ ## Run coverage tests
5151
-coverprofile=test/profile.out $(PKGS)
5252
$Q $(GO) tool cover -html=test/profile.out -o test/coverage.html
5353
$Q $(GO) tool gocover-cobertura < test/profile.out > test/coverage.xml # Inaccurate?
54-
@echo -n "Code coverage: "; \
55-
echo "scale=1;$$(sed -En 's/^<coverage line-rate="([0-9.]+)".*/\1/p' test/coverage.xml) * 100 / 1" | bc -q
54+
@printf "Code coverage: "; \
55+
go tool cover -func test/profile.out | awk '($$1 == "total:") { print $$NF}'
5656

5757
.PHONY: lint
5858
lint: ; $(info $(M) running golint…) @ ## Run golint

0 commit comments

Comments
 (0)