From 34330f1e341834f0e327d17b1cf83ba23dc63e56 Mon Sep 17 00:00:00 2001 From: Laurent Demailly Date: Sun, 30 Jun 2024 14:45:54 -0700 Subject: [PATCH] adding make coverage now that https://github.com/fortio/workflows/pull/51 is done --- .gitignore | 2 ++ .vscode/launch.json | 14 ++++++++++++++ Makefile | 8 ++++++++ 3 files changed, 24 insertions(+) create mode 100644 .vscode/launch.json diff --git a/.gitignore b/.gitignore index 9b5da77..fdd9bd7 100644 --- a/.gitignore +++ b/.gitignore @@ -2,3 +2,5 @@ .golangci.yml fullsize smallsize +coverage.out +coverage?.out diff --git a/.vscode/launch.json b/.vscode/launch.json new file mode 100644 index 0000000..a75431d --- /dev/null +++ b/.vscode/launch.json @@ -0,0 +1,14 @@ +{ + "version": "0.2.0", + "configurations": [ + { + "name": "Launch test function with tags", + "type": "go", + "request": "launch", + "mode": "test", + "program": "${workspaceFolder}", + "buildFlags": "-tags=no_json" + } + + ] +} diff --git a/Makefile b/Makefile index 38295ab..8e202f9 100644 --- a/Makefile +++ b/Makefile @@ -6,6 +6,14 @@ test: go test -tags no_json ./... go test -tags no_http ./... +coverage: + go test -coverprofile=coverage1.out ./... + go test -tags no_net -coverprofile=coverage2.out ./... + go test -tags no_json -coverprofile=coverage3.out ./... + go test -tags no_http,no_json -coverprofile=coverage4.out ./... + gocovmerge coverage?.out > coverage.out + # go tool cover -html=coverage.out + example: @echo "### Colorized (default) ###" go run ./levelsDemo