rewrite versionFromBuild()

This commit is contained in:
onyx-and-iris 2026-02-16 01:19:54 +00:00
parent 5485927311
commit 754369668b

View File

@ -151,14 +151,15 @@ func run() (func(), error) {
// versionFromBuild retrieves the version information from the build metadata. // versionFromBuild retrieves the version information from the build metadata.
func versionFromBuild() string { func versionFromBuild() string {
if version == "" { if version != "" {
info, ok := debug.ReadBuildInfo() return version
if !ok {
return "(unable to read build info)"
}
version = strings.Split(info.Main.Version, "-")[0]
} }
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.