aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPaul Duncan <pabs@pablotron.org>2022-01-31 18:37:45 -0500
committerPaul Duncan <pabs@pablotron.org>2022-01-31 18:37:45 -0500
commite24e4810ac1138418a9636ee94e9473df8876063 (patch)
tree7736c10516543af16ce7334d9f4ebb953856e669
parent531c15b6c5f6c3d274ffec11a15b0ad22d685a90 (diff)
downloadcvez-e24e4810ac1138418a9636ee94e9473df8876063.tar.bz2
cvez-e24e4810ac1138418a9636ee94e9473df8876063.zip
add testjson, cov, covhtml, and clean targets, add coverage files to .gitignore
-rw-r--r--.gitignore2
-rw-r--r--Makefile19
2 files changed, 19 insertions, 2 deletions
diff --git a/.gitignore b/.gitignore
index fc024e4..4fedfdf 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,2 +1,4 @@
*.sw?
nvd
+coverage.out
+coverage.html
diff --git a/Makefile b/Makefile
index a9cb09b..7ff8ea9 100644
--- a/Makefile
+++ b/Makefile
@@ -1,7 +1,22 @@
-.PHONY=all test
+.PHONY=all test cov covhtml clean
all:
- go1.18beta1 build
+ go1.18beta1 build -ldflags='-s -w'
test:
go1.18beta1 test ./...
+
+testjson:
+ go1.18beta1 test -json ./...
+
+cov:
+ go1.18beta1 test -coverprofile=coverage.out ./... && \
+ go1.18beta1 tool cover -func=coverage.out
+
+covhtml:
+ go1.18beta1 test -coverprofile=coverage.out ./... && \
+ go1.18beta1 tool cover -html=coverage.out -o coverage.html && \
+ xdg-open ./coverage.html
+
+clean:
+ go1.18beta1 clean