From 3dbf09a9efc26a6cb9dbd9b8e1e6d154cea5768a Mon Sep 17 00:00:00 2001 From: Aleksandar Stojanov Date: Wed, 25 Oct 2023 23:04:23 +0200 Subject: [PATCH] add ldflags to goreleaser.yaml Signed-off-by: Aleksandar Stojanov --- .goreleaser.yaml | 5 +++++ Makefile | 5 ++--- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/.goreleaser.yaml b/.goreleaser.yaml index 5d1ad35..c4e9445 100644 --- a/.goreleaser.yaml +++ b/.goreleaser.yaml @@ -21,6 +21,11 @@ builds: goarch: - amd64 - arm64 + ldflags: + - -s -w + -X main.Version={{ .Tag }} + -X main.GitCommit={{ .Commit }} + -X main.BuildDate={{ .Date }} binary: schema archives: diff --git a/Makefile b/Makefile index cba070e..0f33a4b 100644 --- a/Makefile +++ b/Makefile @@ -7,11 +7,10 @@ BUILD_DATE := $(shell date -u '+%Y-%m-%d %I:%M:%S UTC' 2> /dev/null) GIT_HASH := $(shell git rev-parse HEAD 2> /dev/null) OS_FAMILY := $(shell (uname | tr '[:upper:]' '[:lower:]')) -OS_ARCH := $(shell (uname -m | tr '[:upper:]' '[:lower:]')) GOPATH ?= $(shell go env GOPATH) PATH := $(GOPATH)/bin:$(PATH) -GO_BUILD_ENV_VARS = $(if $(GO_ENV_VARS),$(GO_ENV_VARS),CGO_ENABLED=0 GOOS=${OS_FAMILY} GOARCH=${OS_ARCH}) +GO_BUILD_ENV_VARS = $(if $(GO_ENV_VARS),$(GO_ENV_VARS),CGO_ENABLED=0 GOOS=${OS_FAMILY}) GO_BUILD_ARGS = -buildvcs=false -ldflags "-X main.GitCommit=${GIT_HASH}" HELM_PLUGINS = $(shell helm env HELM_PLUGINS) @@ -104,4 +103,4 @@ help: ## Show this help message @echo " PLUGIN_SHORTNAME The short name of the plugin (default: $(PLUGIN_SHORTNAME))" @echo "" -default: help \ No newline at end of file +default: help