From 9576f8e6d0d79eb81c506bbc777197dc3bf6ede1 Mon Sep 17 00:00:00 2001 From: David Boenig <45599674+dboenig@users.noreply.github.com> Date: Thu, 5 Mar 2020 15:53:50 +0000 Subject: [PATCH] =?UTF-8?q?Set=20GOFLAGS=20default=20environment=20variabl?= =?UTF-8?q?e=20in=20Makefile=20to=20enable=20overwr=E2=80=A6=20(#870)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Set GOFLAGS default environment variable in Makefile to enable overwrites * Fix quotation to enable to pass in multiple flags --- Makefile | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/Makefile b/Makefile index 2b06984cac..28cf97df76 100644 --- a/Makefile +++ b/Makefile @@ -7,6 +7,7 @@ PREFIX = nginx/nginx-ingress DOCKER_TEST_RUN = docker run --rm -v $(shell pwd):/go/src/github.com/nginxinc/kubernetes-ingress -w /go/src/github.com/nginxinc/kubernetes-ingress DOCKER_BUILD_RUN = docker run --rm -v $(shell pwd):/go/src/github.com/nginxinc/kubernetes-ingress -w /go/src/github.com/nginxinc/kubernetes-ingress/cmd/nginx-ingress/ GOLANG_CONTAINER = golang:1.13 +GOFLAGS ?= -mod=vendor DOCKERFILEPATH = build DOCKERFILE = Dockerfile # note, this can be overwritten e.g. can be DOCKERFILE=DockerFileForPlus @@ -19,9 +20,9 @@ GIT_COMMIT=$(shell git rev-parse --short HEAD) nginx-ingress: ifeq ($(BUILD_IN_CONTAINER),1) - $(DOCKER_BUILD_RUN) -e CGO_ENABLED=0 -e GO111MODULE=on -e GOFLAGS='-mod=vendor' $(GOLANG_CONTAINER) go build -installsuffix cgo -ldflags "-w -X main.version=${VERSION} -X main.gitCommit=${GIT_COMMIT}" -o /go/src/github.com/nginxinc/kubernetes-ingress/nginx-ingress + $(DOCKER_BUILD_RUN) -e CGO_ENABLED=0 -e GO111MODULE=on -e GOFLAGS='$(GOFLAGS)' $(GOLANG_CONTAINER) go build -installsuffix cgo -ldflags "-w -X main.version=${VERSION} -X main.gitCommit=${GIT_COMMIT}" -o /go/src/github.com/nginxinc/kubernetes-ingress/nginx-ingress else - CGO_ENABLED=0 GO111MODULE=on GOFLAGS='-mod=vendor' GOOS=linux go build -installsuffix cgo -ldflags "-w -X main.version=${VERSION} -X main.gitCommit=${GIT_COMMIT}" -o nginx-ingress github.com/nginxinc/kubernetes-ingress/cmd/nginx-ingress + CGO_ENABLED=0 GO111MODULE=on GOFLAGS='$(GOFLAGS)' GOOS=linux go build -installsuffix cgo -ldflags "-w -X main.version=${VERSION} -X main.gitCommit=${GIT_COMMIT}" -o nginx-ingress github.com/nginxinc/kubernetes-ingress/cmd/nginx-ingress endif lint: @@ -29,9 +30,9 @@ lint: test: ifeq ($(BUILD_IN_CONTAINER),1) - $(DOCKER_TEST_RUN) -e GO111MODULE=on -e GOFLAGS='-mod=vendor' $(GOLANG_CONTAINER) go test ./... + $(DOCKER_TEST_RUN) -e GO111MODULE=on -e GOFLAGS='$(GOFLAGS)' $(GOLANG_CONTAINER) go test ./... else - GO111MODULE=on GOFLAGS='-mod=vendor' go test ./... + GO111MODULE=on GOFLAGS='$(GOFLAGS)' go test ./... endif verify-codegen: