From a7bae0355bcd244afaa9122826e08bd4e5853227 Mon Sep 17 00:00:00 2001 From: Jeroen Wijenbergh Date: Thu, 2 May 2024 11:05:37 +0200 Subject: Makefile: Add a coverage target --- .gitignore | 3 +++ Makefile | 5 ++++- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/.gitignore b/.gitignore index 57e8e18..0ae1ec6 100644 --- a/.gitignore +++ b/.gitignore @@ -13,3 +13,6 @@ # build output /eduvpn-common-cli /lib + +# coverage profile +/common.cov diff --git a/Makefile b/Makefile index e72789f..44eecab 100644 --- a/Makefile +++ b/Makefile @@ -1,5 +1,5 @@ .DEFAULT_GOAL := build -.PHONY: build fmt cli clean +.PHONY: build fmt cli clean coverage VERSION := $(shell grep -o 'const Version = "[^"]*' internal/version/version.go | cut -d '"' -f 2) @@ -23,3 +23,6 @@ test: clean: rm -rf lib go clean +coverage: + go test -v -coverpkg=./... -coverprofile=common.cov ./... + go tool cover -func common.cov -- cgit v1.2.3