From 86100ab572a1e7d8dce1ed1d8b10c4606a89b6c6 Mon Sep 17 00:00:00 2001 From: Charlie Vieth Date: Sat, 24 Jul 2021 22:42:00 -0400 Subject: [PATCH] Makefile: improve cover target --- .gitignore | 2 +- Makefile | 11 ++++++++--- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/.gitignore b/.gitignore index 43c56ad..ec7761e 100644 --- a/.gitignore +++ b/.gitignore @@ -14,4 +14,4 @@ # Dependency directories (remove the comment below to include it) /vendor -cover.html +/build diff --git a/Makefile b/Makefile index b57ba9d..3bad986 100644 --- a/Makefile +++ b/Makefile @@ -19,6 +19,11 @@ all: test reoncetest lint .PHONY: cover cover: # runs all tests against the package, generating a coverage report and opening it in the default browser - go test -race -covermode=atomic -coverprofile=cover.out ./... - go tool cover -html cover.out -o cover.html - which open && open cover.html + @mkdir -p ./build && \ + go test -race -covermode=atomic -coverprofile=./build/cover.out ./... && \ + go tool cover -html ./build/cover.out -o ./build/cover.html && \ + which open && open ./build/cover.html + +.PHONY: clean +clean: + rm -rf ./build