rewrite versionFromBuild()

This commit is contained in:
onyx-and-iris 2026-02-16 01:26:12 +00:00
parent 0fe373d1d1
commit e4f3366a67

View File

@ -124,14 +124,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]
} }
func connectRcon(host string, port int, password string) (*q3rcon.Rcon, func(), error) { func connectRcon(host string, port int, password string) (*q3rcon.Rcon, func(), error) {