From 836040d6a9045ac6f03f0d2e664a6f14ca9dddb7 Mon Sep 17 00:00:00 2001 From: Evan Baker Date: Thu, 28 Mar 2024 18:45:28 +0000 Subject: [PATCH] fix: embed version in kubectl-retina with goreleaser Signed-off-by: Evan Baker --- .goreleaser.yaml | 6 +++--- cli/cmd/version.go | 3 ++- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/.goreleaser.yaml b/.goreleaser.yaml index af498b83d0..78164e1806 100644 --- a/.goreleaser.yaml +++ b/.goreleaser.yaml @@ -22,15 +22,15 @@ builds: - windows - darwin ldflags: - - -X cli/cmd.Version={{.Version}} + - -X github.com/microsoft/retina/cli/cmd.Version={{.Version}} main: cli/main.go archives: - name_template: "{{ .Binary }}-v{{ .Version }}" wrap_in_directory: false format_overrides: - - goos: windows - format: zip + - goos: windows + format: zip changelog: sort: asc diff --git a/cli/cmd/version.go b/cli/cmd/version.go index 5b4cca5017..92cabd3436 100644 --- a/cli/cmd/version.go +++ b/cli/cmd/version.go @@ -10,7 +10,8 @@ import ( ) // This variable is used by the "version" command and is set during build. -var Version = "undefined" +// Defaults to a safe value if not set. +var Version = "v0.0.2" func VersionCmd() *cobra.Command { cmd := &cobra.Command{