try to get version from runtime/debug
This commit is contained in:
parent
8f0b197c3e
commit
95842b00fd
2 changed files with 15 additions and 9 deletions
|
@ -1,16 +1,23 @@
|
|||
package metadata
|
||||
|
||||
import (
|
||||
"os"
|
||||
"fmt"
|
||||
"runtime/debug"
|
||||
"strings"
|
||||
)
|
||||
|
||||
func getVersion() string {
|
||||
content, _ := os.ReadFile("version.txt")
|
||||
version := strings.TrimSpace(string(content))
|
||||
var (
|
||||
GoTomatoVersion = "" // The GoTomato version
|
||||
ProtocolVersion = "" // The protocol version
|
||||
)
|
||||
|
||||
return version
|
||||
func init() {
|
||||
info, ok := debug.ReadBuildInfo()
|
||||
fmt.Printf("%v", info)
|
||||
if !ok {
|
||||
GoTomatoVersion = "unknown"
|
||||
}
|
||||
|
||||
var GoTomatoVersion = getVersion() // The GoTomato version
|
||||
var ProtocolVersion = strings.Split(GoTomatoVersion, ".")[0] // The protocol version
|
||||
GoTomatoVersion = info.Main.Version
|
||||
ProtocolVersion = strings.Split(GoTomatoVersion, ".")[0]
|
||||
}
|
||||
|
|
|
@ -1 +0,0 @@
|
|||
devel
|
Loading…
Reference in a new issue