Skip to content

Commit 9576f8e

Browse files
martialonlinelucacome
authored andcommitted
Set GOFLAGS default environment variable in Makefile to enable overwr… (#870)
* Set GOFLAGS default environment variable in Makefile to enable overwrites * Fix quotation to enable to pass in multiple flags
1 parent 44f0205 commit 9576f8e

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

Makefile

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ PREFIX = nginx/nginx-ingress
77
DOCKER_TEST_RUN = docker run --rm -v $(shell pwd):/go/src/github.com/nginxinc/kubernetes-ingress -w /go/src/github.com/nginxinc/kubernetes-ingress
88
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/
99
GOLANG_CONTAINER = golang:1.13
10+
GOFLAGS ?= -mod=vendor
1011
DOCKERFILEPATH = build
1112
DOCKERFILE = Dockerfile # note, this can be overwritten e.g. can be DOCKERFILE=DockerFileForPlus
1213

@@ -19,19 +20,19 @@ GIT_COMMIT=$(shell git rev-parse --short HEAD)
1920

2021
nginx-ingress:
2122
ifeq ($(BUILD_IN_CONTAINER),1)
22-
$(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
23+
$(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
2324
else
24-
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
25+
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
2526
endif
2627

2728
lint:
2829
golangci-lint run
2930

3031
test:
3132
ifeq ($(BUILD_IN_CONTAINER),1)
32-
$(DOCKER_TEST_RUN) -e GO111MODULE=on -e GOFLAGS='-mod=vendor' $(GOLANG_CONTAINER) go test ./...
33+
$(DOCKER_TEST_RUN) -e GO111MODULE=on -e GOFLAGS='$(GOFLAGS)' $(GOLANG_CONTAINER) go test ./...
3334
else
34-
GO111MODULE=on GOFLAGS='-mod=vendor' go test ./...
35+
GO111MODULE=on GOFLAGS='$(GOFLAGS)' go test ./...
3536
endif
3637

3738
verify-codegen:

0 commit comments

Comments
 (0)