Update Makefile.common to support libraries
Specifically tsdb and client_golang that don't use vendoring.
@@ -31,8 +31,10 @@ FIRST_GOPATH := $(firstword $(subst :, ,$(shell $(GO) env GOPATH)))
GOOPTS ?=
ifneq (,$(wildcard go.mod))
ifeq ($(shell $(GO) version | grep -E 'go1\.(10|[0-9])\.'),)
+ifneq (,$(wildcard vendor))
# Always use the local vendor/ directory to satisfy the dependencies.
GOOPTS := $(GOOPTS) -mod=vendor
+endif
# Enable module support forcibly just in case the directory is inside GOPATH (and Travis CI).
GO111MODULE := on
@@ -123,10 +125,12 @@ else
@echo ">> running check for unused/missing packages in go.mod"
GO111MODULE=$(GO111MODULE) $(GO) mod tidy
@git diff --exit-code -- go.sum go.mod
+ifneq (,$(wildcard vendor))
@echo ">> running check for unused packages in vendor/"
GO111MODULE=$(GO111MODULE) $(GO) mod vendor
@git diff --exit-code -- go.sum go.mod vendor/
endif
+endif
.PHONY: common-build
common-build: promu
