From a60d2c152f2b748fcdcade9373f3af2f103a774d Mon Sep 17 00:00:00 2001 From: Simon Pasquier Date: Fri, 9 Nov 2018 11:55:04 +0100 Subject: [PATCH] Makefile.common: clean up Signed-off-by: Simon Pasquier --- Makefile.common | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/Makefile.common b/Makefile.common index 3a18b6c575..8f62b47495 100644 --- a/Makefile.common +++ b/Makefile.common @@ -29,8 +29,13 @@ GO ?= go GOFMT ?= $(GO)fmt FIRST_GOPATH := $(firstword $(subst :, ,$(shell $(GO) env GOPATH))) GOOPTS ?= + +GO_VERSION ?= $(shell $(GO) version) +GO_VERSION_NUMBER ?= $(word 3, $(GO_VERSION)) +PRE_GO_111 ?= $(shell echo $(GO_VERSION_NUMBER) | grep -E 'go1\.(10|[0-9])\.') + unexport GOVENDOR -ifeq ($(shell $(GO) version | grep -E 'go1\.(10|[0-9])\.'),) +ifeq (, $(PRE_GO_111)) ifneq (,$(wildcard go.mod)) # Enforce Go modules support just in case the directory is inside GOPATH (and for Travis CI). GO111MODULE := on @@ -44,7 +49,7 @@ else ifneq (,$(wildcard go.mod)) ifneq (,$(wildcard vendor)) $(warning This repository requires Go >= 1.11 because of Go modules) -$(warning Some recipes may not work as expected as the current Go runtime is '$(shell $(GO) version)') +$(warning Some recipes may not work as expected as the current Go runtime is '$(GO_VERSION_NUMBER)') endif else # This repository isn't using Go modules (yet).