2024-10-22 15:18:05 +00:00
|
|
|
package metadata
|
|
|
|
|
2024-11-09 14:59:30 +00:00
|
|
|
import (
|
2024-11-09 18:14:48 +00:00
|
|
|
"runtime/debug"
|
2024-11-09 14:59:30 +00:00
|
|
|
)
|
2024-10-27 21:46:58 +00:00
|
|
|
|
2024-11-09 14:59:30 +00:00
|
|
|
var (
|
2024-11-09 18:14:48 +00:00
|
|
|
version = ""
|
|
|
|
ProtocolVersion = "0"
|
2024-11-09 14:59:30 +00:00
|
|
|
)
|
|
|
|
|
|
|
|
func init() {
|
2024-11-09 18:14:48 +00:00
|
|
|
info, ok := debug.ReadBuildInfo()
|
|
|
|
if !ok || info.Main.Version == "" {
|
|
|
|
version = "unknown"
|
|
|
|
} else {
|
|
|
|
if version == "" {
|
|
|
|
version = info.Main.Version
|
|
|
|
}
|
2024-11-09 14:59:30 +00:00
|
|
|
}
|
2024-11-09 18:14:48 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
func GetVersion() string {
|
|
|
|
return version
|
2024-11-09 14:59:30 +00:00
|
|
|
}
|