From 754369668b26c4c51969969f20ae4a3cd0ec501f Mon Sep 17 00:00:00 2001 From: onyx-and-iris Date: Mon, 16 Feb 2026 01:19:54 +0000 Subject: [PATCH] rewrite versionFromBuild() --- cmd/vbantxt/main.go | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/cmd/vbantxt/main.go b/cmd/vbantxt/main.go index 02ddd5b..c87beb2 100644 --- a/cmd/vbantxt/main.go +++ b/cmd/vbantxt/main.go @@ -151,14 +151,15 @@ func run() (func(), error) { // versionFromBuild retrieves the version information from the build metadata. func versionFromBuild() string { - if version == "" { - info, ok := debug.ReadBuildInfo() - if !ok { - return "(unable to read build info)" - } - version = strings.Split(info.Main.Version, "-")[0] + if version != "" { + return version } - return version + + info, ok := debug.ReadBuildInfo() + if !ok { + return "(unable to read version)" + } + return strings.Split(info.Main.Version, "-")[0] } // createClient creates a new vban client with the provided options.