Compare commits

..

1 Commits
v0.6.2 ... main

Author SHA1 Message Date
be2715816b move versionFromBuild() 2026-03-07 12:40:58 +00:00

View File

@ -20,6 +20,19 @@ import (
var version string // Version will be set at build time 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. // Flags holds the command-line flags for the VBANTXT client.
type Flags struct { type Flags struct {
Host string Host string
@ -149,19 +162,6 @@ func run() (func(), error) {
return closer, nil 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. // createClient creates a new vban client with the provided options.
func createClient(flags *Flags) (*vbantxt.VbanTxt, func(), error) { func createClient(flags *Flags) (*vbantxt.VbanTxt, func(), error) {
client, err := vbantxt.New( client, err := vbantxt.New(