From a7e30684db8a9362121e59d77fb34c0e8da1bab2 Mon Sep 17 00:00:00 2001 From: "ev.lekht" Date: Tue, 3 Dec 2024 18:40:44 +0400 Subject: [PATCH] wip --- cmd/camino_messenger_bot.go | 5 +++-- internal/constants/constants.go | 18 +++++++----------- scripts/build.sh | 4 ++-- 3 files changed, 12 insertions(+), 15 deletions(-) diff --git a/cmd/camino_messenger_bot.go b/cmd/camino_messenger_bot.go index 2e9d64a0..98ddbc5b 100644 --- a/cmd/camino_messenger_bot.go +++ b/cmd/camino_messenger_bot.go @@ -16,7 +16,7 @@ import ( var rootCmd = &cobra.Command{ Use: "camino-messenger-bot", Short: "starts camino messenger bot", - Version: constants.BotVersion, + Version: constants.AppVersion, SuggestFor: []string{"camino-messenger", "camino-messenger-bot", "camino-bot", "cmb"}, RunE: rootFunc, } @@ -58,7 +58,8 @@ func rootFunc(cmd *cobra.Command, _ []string) error { logger := zapLogger.Sugar() defer func() { _ = logger.Sync() }() - logger.Infof("App version: %s (git: %s)", constants.BotVersion, constants.BotGitCommit) // TODO@ + logger.Infof("App version: %s (git: %s)", constants.AppVersion, constants.AppGitCommit) + logger.Infof("Protocol version: %s", constants.ProtocolVersion) app, err := app.NewApp(ctx, cfg, logger) if err != nil { diff --git a/internal/constants/constants.go b/internal/constants/constants.go index c9f39bc5..94539d5c 100644 --- a/internal/constants/constants.go +++ b/internal/constants/constants.go @@ -1,15 +1,11 @@ package constants -const ( - ProtocolVersion = "v10.0.0" +const ProtocolVersion = "v10.0.0" - // BotVersion and BotGitCommit are set by go build -ldflags - BotVersion = "" - BotGitCommit = "" -) +var ( + // AppVersion is set by go build -ldflags + AppVersion = "" -// var ( -// // BotVersion and BotGitCommit are set by go build -ldflags -// BotVersion string -// BotGitCommit string -// ) + // AppGitCommit is set by go build -ldflags + AppGitCommit = "" +) diff --git a/scripts/build.sh b/scripts/build.sh index fe5cb1bf..2254682f 100755 --- a/scripts/build.sh +++ b/scripts/build.sh @@ -31,8 +31,8 @@ fi # Load the constants source "$CAMINOBOT_PATH"/scripts/constants.sh -LDFLAGS="-X github.com/chain4travel/camino-messenger-bot/cmd.GitCommit=$git_commit" -LDFLAGS="$LDFLAGS -X github.com/chain4travel/camino-messenger-bot/cmd.Version=$git_tag" +LDFLAGS="-X github.com/chain4travel/camino-messenger-bot/internal/constants.AppGitCommit=$git_commit" +LDFLAGS="$LDFLAGS -X github.com/chain4travel/camino-messenger-bot/internal/constants.AppVersion=$git_tag" # Build the Go application echo "Building camino-messenger-bot..."