From b930487dc5993e1327162bc62b9a27262b50e1b6 Mon Sep 17 00:00:00 2001 From: Evan Lezar Date: Mon, 7 Jun 2021 13:20:58 +0200 Subject: [PATCH] Add coverage to go tests Signed-off-by: Evan Lezar --- .gitignore | 1 + Makefile | 6 +++++- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/.gitignore b/.gitignore index 76085a7b..f766658d 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,4 @@ dist *.swp *.swo +/coverage.out \ No newline at end of file diff --git a/Makefile b/Makefile index 3c19c02e..cfc07265 100644 --- a/Makefile +++ b/Makefile @@ -63,5 +63,9 @@ misspell: vet: go vet $(MODULE)/... +COVERAGE_FILE := coverage.out test: - go test $(MODULE)/... + go test -coverprofile=$(COVERAGE_FILE) $(MODULE)/... + +coverage: test + go tool cover -func=$(COVERAGE_FILE)