Makefile.common: clean up

Signed-off-by: Simon Pasquier <spasquie@redhat.com>
This commit is contained in:
Simon Pasquier 2018-11-09 11:55:04 +01:00
parent e3cd3ab79a
commit a60d2c152f

View file

@ -29,8 +29,13 @@ GO ?= go
GOFMT ?= $(GO)fmt GOFMT ?= $(GO)fmt
FIRST_GOPATH := $(firstword $(subst :, ,$(shell $(GO) env GOPATH))) FIRST_GOPATH := $(firstword $(subst :, ,$(shell $(GO) env GOPATH)))
GOOPTS ?= 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 unexport GOVENDOR
ifeq ($(shell $(GO) version | grep -E 'go1\.(10|[0-9])\.'),) ifeq (, $(PRE_GO_111))
ifneq (,$(wildcard go.mod)) ifneq (,$(wildcard go.mod))
# Enforce Go modules support just in case the directory is inside GOPATH (and for Travis CI). # Enforce Go modules support just in case the directory is inside GOPATH (and for Travis CI).
GO111MODULE := on GO111MODULE := on
@ -44,7 +49,7 @@ else
ifneq (,$(wildcard go.mod)) ifneq (,$(wildcard go.mod))
ifneq (,$(wildcard vendor)) ifneq (,$(wildcard vendor))
$(warning This repository requires Go >= 1.11 because of Go modules) $(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 endif
else else
# This repository isn't using Go modules (yet). # This repository isn't using Go modules (yet).