From 47b3dc0e40a327ae5626771af7d8017cf8346ab9 Mon Sep 17 00:00:00 2001 From: Marco Mariani Date: Mon, 17 Jul 2023 14:57:32 +0200 Subject: [PATCH] avoid ~ in pkg/version.Version to select the hub branch --- Makefile | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/Makefile b/Makefile index 08958ced3..8ee50156c 100644 --- a/Makefile +++ b/Makefile @@ -64,8 +64,12 @@ bool = $(if $(filter $(call lc, $1),1 yes true),1,0) MAKE_FLAGS = --no-print-directory GOARCH=$(GOARCH) GOOS=$(GOOS) RM="$(RM)" WIN_IGNORE_ERR="$(WIN_IGNORE_ERR)" CP="$(CP)" CPR="$(CPR)" MKDIR="$(MKDIR)" +# Normalize the version number because semver does not handle '~' correctly +# This string is used to retrieve the correct hub branch +PKG_VERSION := $(subst ~,-,$(BUILD_VERSION)) + LD_OPTS_VARS= \ --X 'github.com/crowdsecurity/go-cs-lib/pkg/version.Version=$(BUILD_VERSION)' \ +-X 'github.com/crowdsecurity/go-cs-lib/pkg/version.Version=$(PKG_VERSION)' \ -X 'github.com/crowdsecurity/go-cs-lib/pkg/version.BuildDate=$(BUILD_TIMESTAMP)' \ -X 'github.com/crowdsecurity/go-cs-lib/pkg/version.Tag=$(BUILD_TAG)' \ -X '$(GO_MODULE_NAME)/pkg/cwversion.Codename=$(BUILD_CODENAME)' \