From 1d00bdd2a4443357eaae18973873111c119ceeda Mon Sep 17 00:00:00 2001 From: Matthias Radestock Date: Mon, 12 Oct 2015 18:04:07 +0100 Subject: [PATCH] a better way to restrict coverage this better fixes #1524. --- Makefile | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/Makefile b/Makefile index a4efc0af..f36f39ae 100644 --- a/Makefile +++ b/Makefile @@ -45,6 +45,8 @@ NETGO_CHECK=@strings $@ | grep cgo_stub\\\.go >/dev/null || { \ } BUILD_FLAGS=-ldflags "-extldflags \"-static\" -X main.version $(WEAVE_VERSION)" -tags netgo +PACKAGE_BASE=$(shell go list -e ./) + all: $(WEAVE_EXPORT) $(RUNNER_EXE) travis: $(EXES) @@ -54,7 +56,7 @@ update: $(WEAVER_EXE) $(WEAVEPROXY_EXE): common/*.go common/*/*.go net/*.go ifeq ($(COVERAGE),true) - $(eval COVERAGE_MODULES := $(shell (go list ./$(@D); go list -f '{{join .Deps "\n"}}' ./$(@D) | grep "^github.com/weaveworks/weave/") | paste -s -d,)) + $(eval COVERAGE_MODULES := $(shell (go list ./$(@D); go list -f '{{join .Deps "\n"}}' ./$(@D) | grep "^$(PACKAGE_BASE)/") | paste -s -d,)) go get -t -tags netgo ./$(@D) go test -c -o ./$@ $(BUILD_FLAGS) -v -covermode=atomic -coverpkg $(COVERAGE_MODULES) ./$(@D)/ else