make: Ignore coverage for generator scripts
diff --git a/.codecov.yml b/.codecov.yml
index 912be70..571116c 100644
--- a/.codecov.yml
+++ b/.codecov.yml
@@ -13,6 +13,7 @@
if_not_found: success # if parent is not found report status as success, error, or failure
if_ci_failed: error # if ci fails report status as success, error, or failure
+# Also update COVER_IGNORE_PKGS in the Makefile.
ignore:
- /internal/gen-atomicint/
- /internal/gen-valuewrapper/
diff --git a/Makefile b/Makefile
index 8d3127f..7203311 100644
--- a/Makefile
+++ b/Makefile
@@ -7,6 +7,11 @@
GO_FILES ?= $(shell find . '(' -path .git -o -path vendor ')' -prune -o -name '*.go' -print)
+# Also update ignore section in .codecov.yml.
+COVER_IGNORE_PKGS = \
+ go.uber.org/atomic/internal/gen-atomicint \
+ go.uber.org/atomic/internal/gen-valuewrapper
+
.PHONY: build
build:
go build ./...
@@ -37,9 +42,15 @@
.PHONY: lint
lint: gofmt golint generatenodirty
+# comma separated list of packages to consider for code coverage.
+COVER_PKG = $(shell \
+ go list -find ./... | \
+ grep -v $(foreach pkg,$(COVER_IGNORE_PKGS),-e "^$(pkg)$$") | \
+ paste -sd, -)
+
.PHONY: cover
cover:
- go test -coverprofile=cover.out -coverpkg ./... -v ./...
+ go test -coverprofile=cover.out -coverpkg $(COVER_PKG) -v ./...
go tool cover -html=cover.out -o cover.html
.PHONY: generate