diff --git a/cmd/soundtouch-cli/common.go b/cmd/soundtouch-cli/common.go index e7973be..6a9c89f 100644 --- a/cmd/soundtouch-cli/common.go +++ b/cmd/soundtouch-cli/common.go @@ -150,7 +150,6 @@ func PrintWarning(message string) { // showVersionInfo displays detailed version information including build details func showVersionInfo(_ *cli.Context) error { - version, commit, date := getBuildInfo() fmt.Printf("soundtouch-cli version %s\n", version) fmt.Printf("Build commit: %s\n", commit) fmt.Printf("Build date: %s\n", date) diff --git a/cmd/soundtouch-cli/main.go b/cmd/soundtouch-cli/main.go index 59cd916..f2d9dd4 100644 --- a/cmd/soundtouch-cli/main.go +++ b/cmd/soundtouch-cli/main.go @@ -9,12 +9,15 @@ import ( "github.com/urfave/cli/v2" ) -// getBuildInfo extracts version information from debug.BuildInfo -func getBuildInfo() (version, commit, date string) { +// Package-level variables for build information +var ( version = "dev" - commit = "unknown" - date = "unknown" + commit = "unknown" + date = "unknown" +) +// updateBuildInfo extracts version information from debug.BuildInfo and updates package variables +func updateBuildInfo() { if info, ok := debug.ReadBuildInfo(); ok { // Get version from module info if info.Main.Version != "" && info.Main.Version != "(devel)" { @@ -33,12 +36,10 @@ func getBuildInfo() (version, commit, date string) { } } } - - return } func main() { - version, _, _ := getBuildInfo() + updateBuildInfo() app := &cli.App{ Name: "soundtouch-cli",