From 1bceb2f8c2a3dba90d9cdcd0f8f30bb9ee0606fa Mon Sep 17 00:00:00 2001 From: Dirk Wilden Date: Fri, 8 Mar 2024 12:20:01 +0100 Subject: [PATCH] fix version reporting --- .goreleaser.yml | 4 ++-- Makefile | 4 ++-- cmd/version.go | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/.goreleaser.yml b/.goreleaser.yml index 2cd49c9..b717dd9 100644 --- a/.goreleaser.yml +++ b/.goreleaser.yml @@ -5,7 +5,7 @@ builds: - env: - CGO_ENABLED=0 ldflags: - - -s -w -X github.com/deviceinsight/kafkactl/cmd.Version={{.Tag}} -X github.com/deviceinsight/kafkactl/cmd.GitCommit={{.ShortCommit}} -X github.com/deviceinsight/kafkactl/cmd.BuildTime={{.Date}} + - -s -w -X {{ .ModulePath }}/cmd.Version={{.Tag}} -X {{ .ModulePath }}/cmd.GitCommit={{.ShortCommit}} -X {{ .ModulePath }}/cmd.BuildTime={{.Date}} goos: - darwin - linux @@ -63,7 +63,7 @@ snapcrafts: - $HOME/.config/kafkactl/config.yml brews: - - tap: + repository: owner: deviceinsight name: homebrew-packages diff --git a/Makefile b/Makefile index b97ce2c..cc85064 100644 --- a/Makefile +++ b/Makefile @@ -1,12 +1,12 @@ BUILD_TS := $(shell date -Iseconds --utc) COMMIT_SHA := $(shell git rev-parse HEAD) -VERSION := $(shell git describe --abbrev=0 --tags) +VERSION := $(shell git describe --abbrev=0 --tags || echo "latest") export CGO_ENABLED=0 export GOOS=linux export GO111MODULE=on -project=github.com/deviceinsight/kafkactl +project=$(shell go list -m) ld_flags := "-X $(project)/cmd.Version=$(VERSION) -X $(project)/cmd.GitCommit=$(COMMIT_SHA) -X $(project)/cmd.BuildTime=$(BUILD_TS)" FILES := $(shell find . -name '*.go' -type f -not -name '*.pb.go' -not -name '*_generated.go' -not -name '*_test.go') diff --git a/cmd/version.go b/cmd/version.go index 17838b7..f5619d4 100644 --- a/cmd/version.go +++ b/cmd/version.go @@ -8,7 +8,7 @@ import ( "github.com/spf13/cobra" ) -var Version string +var Version = "latest" var BuildTime string var GitCommit string