From 4139c4b2910479d699400ecbaea238c65e18057f Mon Sep 17 00:00:00 2001 From: onyx-and-iris Date: Thu, 19 Jun 2025 02:07:25 +0100 Subject: [PATCH] fix regression reading build info --- main.go | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/main.go b/main.go index 87c9aa5..8260502 100644 --- a/main.go +++ b/main.go @@ -3,7 +3,9 @@ package main import ( "context" + "log" "os" + "runtime/debug" "strings" "github.com/charmbracelet/fang" @@ -56,6 +58,14 @@ func init() { // main is the entry point of the application. // It executes the root command and handles any errors. func main() { + if version == "" { + info, ok := debug.ReadBuildInfo() + if !ok { + log.Fatal("could not read build info") + } + version = strings.Split(info.Main.Version, "-")[0] + } + if err := fang.Execute(context.Background(), rootCmd, fang.WithVersion(version)); err != nil { os.Exit(1) }