From be2715816b6233d4769e3b6971864cbf2f2dbcb1 Mon Sep 17 00:00:00 2001 From: onyx-and-iris Date: Sat, 7 Mar 2026 12:40:58 +0000 Subject: [PATCH] move versionFromBuild() --- cmd/vbantxt/main.go | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/cmd/vbantxt/main.go b/cmd/vbantxt/main.go index c87beb2..9484434 100644 --- a/cmd/vbantxt/main.go +++ b/cmd/vbantxt/main.go @@ -20,6 +20,19 @@ import ( var version string // Version will be set at build time +// versionFromBuild retrieves the version information from the build metadata. +func versionFromBuild() string { + if version != "" { + return version + } + + info, ok := debug.ReadBuildInfo() + if !ok { + return "(unable to read version)" + } + return strings.Split(info.Main.Version, "-")[0] +} + // Flags holds the command-line flags for the VBANTXT client. type Flags struct { Host string @@ -149,19 +162,6 @@ func run() (func(), error) { return closer, nil } -// versionFromBuild retrieves the version information from the build metadata. -func versionFromBuild() string { - if 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. func createClient(flags *Flags) (*vbantxt.VbanTxt, func(), error) { client, err := vbantxt.New(