From 2ec5362abd5d58713c5bcc23816eb45170f922f9 Mon Sep 17 00:00:00 2001 From: Nanik T Date: Sat, 31 Jul 2021 00:44:29 +1000 Subject: [PATCH] fix: BUILDFLAGS updated with correct versions information --- Makefile | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/Makefile b/Makefile index 5974e5c08f..e28818c648 100644 --- a/Makefile +++ b/Makefile @@ -2,7 +2,8 @@ GIT_TAG?= $(shell git describe --always --tags) BIN = gosec FMT_CMD = $(gofmt -s -l -w $(find . -type f -name '*.go' -not -path './vendor/*') | tee /dev/stderr) IMAGE_REPO = securego -BUILDFLAGS := '-w -s' +BUILD_DATE ?= $(shell date +%Y-%m-%d) +BUILDFLAGS := "-w -s -X 'main.Version=$(GIT_TAG)' -X 'main.GitTag=$(GIT_TAG)' -X 'main.BuildDate=$(BUILD_DATE)'" CGO_ENABLED = 0 GO := GO111MODULE=on go GO_NOMOD :=GO111MODULE=off go @@ -55,7 +56,7 @@ release: goreleaser release build-linux: - CGO_ENABLED=$(CGO_ENABLED) GOOS=linux GOARCH=amd64 go build -ldflags $(BUILDFLAGS) -o $(BIN) ./cmd/gosec/ + CGO_ENABLED=$(CGO_ENABLED) GOOS=linux GOARCH=amd64 go build -ldflags=$(BUILDFLAGS) -o $(BIN) ./cmd/gosec/ image: @echo "Building the Docker image..."