From 789990d66a0798d6d5f70280cd5bfccab0e7edd1 Mon Sep 17 00:00:00 2001 From: Tronje Krop Date: Sat, 19 Oct 2024 21:13:38 +0200 Subject: [PATCH] feat: support white background in coverage reports (#109) Signed-off-by: Tronje Krop --- Makefile | 2 +- VERSION | 2 +- config/Makefile | 2 +- config/Makefile.base | 14 ++++++++++---- go.mod | 2 +- go.sum | 4 ++-- 6 files changed, 16 insertions(+), 10 deletions(-) diff --git a/Makefile b/Makefile index b7b1e95..33115c2 100644 --- a/Makefile +++ b/Makefile @@ -12,7 +12,7 @@ export GOPATH ?= $(shell $(GO) env GOPATH) export GOBIN ?= $(GOPATH)/bin # Setup go-make version to use desired build and config scripts. -GOMAKE_DEP ?= github.com/tkrop/go-make@v0.0.105 +GOMAKE_DEP ?= github.com/tkrop/go-make@v0.0.106 INSTALL_FLAGS ?= -mod=readonly -buildvcs=auto # Request targets from go-make targets target. TARGETS := $(shell command -v $(GOBIN)/go-make >/dev/null || \ diff --git a/VERSION b/VERSION index 759a4a1..4ff99ed 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -0.0.105 +0.0.106 diff --git a/config/Makefile b/config/Makefile index b7b1e95..33115c2 100644 --- a/config/Makefile +++ b/config/Makefile @@ -12,7 +12,7 @@ export GOPATH ?= $(shell $(GO) env GOPATH) export GOBIN ?= $(GOPATH)/bin # Setup go-make version to use desired build and config scripts. -GOMAKE_DEP ?= github.com/tkrop/go-make@v0.0.105 +GOMAKE_DEP ?= github.com/tkrop/go-make@v0.0.106 INSTALL_FLAGS ?= -mod=readonly -buildvcs=auto # Request targets from go-make targets target. TARGETS := $(shell command -v $(GOBIN)/go-make >/dev/null || \ diff --git a/config/Makefile.base b/config/Makefile.base index 56e9333..f71a02e 100644 --- a/config/Makefile.base +++ b/config/Makefile.base @@ -237,7 +237,7 @@ go-pkg = $(shell awk -v mode="$(2)" -v filter="$(3)" \ # Setup go-make to use desired build and config scripts. -GOMAKE_DEP := github.com/tkrop/go-make@v0.0.105 +GOMAKE_DEP := github.com/tkrop/go-make@v0.0.106 GOMAKE_MAKEFILE := $(realpath $(firstword $(MAKEFILE_LIST))) GOMAKE_MAKEFILES := $(GOMAKE_MAKEFILE) \ $(wildcard Makefile.vars) $(wildcard Makefile.ext) @@ -782,7 +782,7 @@ $(addprefix git-create-,$(COMMIT_CONVENTION)):: git-create-%: if [ -z "$${BRANCH}" ]; then BRANCH="update-deps"; fi; \ $(call git-message,$*,1); \ $(GIT) checkout -B "$${BRANCH}" && \ - ARGS="" $(GIT) commit --signoff --message "$${MESSAGE}" && \ + ARGS="" $(GIT) commit --signoff --message="$${MESSAGE}" && \ $(GIT) push --set-upstream origin "$${BRANCH}" || \ $(GIT) checkout $${BRANCH}; exit 0; #@ # commits the current change set using the given message with current issue. @@ -954,7 +954,13 @@ test-clean:: test-cover:: @FILE=$$(ls -Art "$(TEST_ALL)" "$(TEST_UNIT)" \ "$(TEST_BENCH)" 2>/dev/null); \ - $(GO) tool cover -html="$${FILE}"; \ + $(GO) tool cover -o "$${FILE}.html" -html="$${FILE}"; \ + if [ $(ARGS) == "white" ]; then \ + sed -i 's/black/whitesmoke/g' "$${FILE}.html"; \ + fi; \ + sensible-browser "$${FILE}.html"; + +# $(GO) tool cover -html="$${FILE}"; \ #@ upload the test coverage report to codacy. test-upload:: @@ -1408,7 +1414,7 @@ BUILD_ARCH ?= $(shell $(GO) env GOARCH) main-pkg = $(patsubst $(1)=%,%,$(firstword $(filter $(1)=%,$(COMMANDS_PKG)))) # Functions and variables to propagate versions to build commands. -LD_CONFIG_PATHS ?= main $(shell $(GO) list ./... | grep "config$$") +LD_CONFIG_PATHS ?= main # $(shell $(GO) list ./... | grep "config$$") ld-flag = $(addprefix -X ,$(addsuffix .$(1),$(LD_CONFIG_PATHS))) ld-flags = $(call ld-flag,Version=$(BUILD_VERSION)) \ $(call ld-flag,Revision=$(shell $(GIT) rev-parse HEAD)) \ diff --git a/go.mod b/go.mod index 78cdc79..f41afd0 100644 --- a/go.mod +++ b/go.mod @@ -5,7 +5,7 @@ go 1.23.2 require ( github.com/golang/mock v1.6.0 github.com/stretchr/testify v1.9.0 - github.com/tkrop/go-config v0.0.5 + github.com/tkrop/go-config v0.0.7 github.com/tkrop/go-testing v0.0.21 ) diff --git a/go.sum b/go.sum index 7ff7e4b..aa7b9ac 100644 --- a/go.sum +++ b/go.sum @@ -20,8 +20,8 @@ github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+ github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= github.com/stretchr/testify v1.9.0 h1:HtqpIVDClZ4nwg75+f6Lvsy/wHu+3BoSGCbBAcpTsTg= github.com/stretchr/testify v1.9.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY= -github.com/tkrop/go-config v0.0.5 h1:Cc/ewDnUU56okUpw6qnRSnFM74lKWU/q5SnEiBMAhF8= -github.com/tkrop/go-config v0.0.5/go.mod h1:3jzeJrvcWVDTZxd30rua8XpO8T946PHRu56kr269dd0= +github.com/tkrop/go-config v0.0.7 h1:pg5ueQcguf2YZALuC1xTnim/SePrCk2sqpZh1w8k6fM= +github.com/tkrop/go-config v0.0.7/go.mod h1:hYWKMPm014Xok/de7qLMLu3Kwy5Yer9yYi7q+3oOx1w= github.com/tkrop/go-testing v0.0.21 h1:lCSLCqsa0KUKOjGOd5euUIpmctSZy9eO7e1pwe2ym2A= github.com/tkrop/go-testing v0.0.21/go.mod h1:RFUX2nk7n4QPUN0doC4R0KS6PqeaK1vWUDy3tBtjjKQ= github.com/yuin/goldmark v1.3.5/go.mod h1:mwnBkeHKe2W/ZEtQ+71ViKU8L12m81fl3OWwC1Zlc8k=