From 77d119ea48a43ef2b0fa2900998e32ee27e92e6f Mon Sep 17 00:00:00 2001 From: Sebastian Sch Date: Wed, 28 Aug 2024 15:39:58 +0300 Subject: [PATCH] Allow the configure golang flags Signed-off-by: Sebastian Sch --- Makefile | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/Makefile b/Makefile index a6104ab..280e76f 100644 --- a/Makefile +++ b/Makefile @@ -34,6 +34,12 @@ IMAGE_BUILD_OPTS += $(DOCKERARGS) # Go tools GO = go Q = $(if $(filter 1,$V),,@) +# Go settings +GO_BUILD_OPTS ?=CGO_ENABLED=0 +GO_LDFLAGS ?= +GO_FLAGS ?= +GO_TAGS ?=-tags no_openssl +export GOPATH?=$(shell go env GOPATH) .PHONY: all all: lint build test-coverage @@ -48,7 +54,7 @@ build: $(BUILDDIR)/$(BINARY_NAME) ; $(info Building $(BINARY_NAME)...) ## Build $(info Done!) $(BUILDDIR)/$(BINARY_NAME): $(GOFILES) | $(BUILDDIR) - @cd $(BASE)/cmd/$(PACKAGE) && CGO_ENABLED=0 $(GO) build -o $(BUILDDIR)/$(BINARY_NAME) -tags no_openssl -ldflags $(LDFLAGS) -v + @cd $(BASE)/cmd/$(PACKAGE) && $(GO_BUILD_OPTS) $(GO) build -o $(BUILDDIR)/$(BINARY_NAME) $(GO_TAGS) -ldflags $(LDFLAGS) -v # Tools