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(