From 48de2a8e10ae591acb9d5299fb36246d1d13af6b Mon Sep 17 00:00:00 2001 From: Hadi <112569860+anotherhadi@users.noreply.github.com> Date: Tue, 19 May 2026 11:34:35 +0200 Subject: [PATCH] add runtime version Signed-off-by: Hadi <112569860+anotherhadi@users.noreply.github.com> --- cmd/spilltea/main.go | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/cmd/spilltea/main.go b/cmd/spilltea/main.go index 07a68fd..114960b 100644 --- a/cmd/spilltea/main.go +++ b/cmd/spilltea/main.go @@ -5,6 +5,7 @@ import ( "net" "os" "path/filepath" + "runtime/debug" tea "charm.land/bubbletea/v2" spilltea "github.com/anotherhadi/spilltea" @@ -21,6 +22,15 @@ import ( // Version is overwritten at build time by goreleaser/ldflag with the current version tag, or "dev" if not set. var version = "dev" +func init() { + if version != "dev" { + return + } + if info, ok := debug.ReadBuildInfo(); ok && info.Main.Version != "" && info.Main.Version != "(devel)" { + version = info.Main.Version + } +} + func main() { var ( flagConfig = flag.StringP("config", "c", "", "path to config file")