Align buildinfo with master

This commit is contained in:
9seconds
2022-08-09 17:43:29 +03:00
parent c1935b4cef
commit 64859069ed
2 changed files with 84 additions and 26 deletions
-26
View File
@@ -3,8 +3,6 @@ package main
import (
"math/rand"
"os"
"runtime/debug"
"strings"
"time"
"github.com/9seconds/mtg/cli"
@@ -12,8 +10,6 @@ import (
kingpin "gopkg.in/alecthomas/kingpin.v2"
)
var version = "dev" // has to be set by ldflags
var (
app = kingpin.New("mtg", "Simple MTPROTO proxy.")
@@ -161,25 +157,3 @@ func main() {
}
}
}
func getVersion() string {
if version != "dev" {
return version
}
info, ok := debug.ReadBuildInfo()
if !ok {
return version
}
builder := strings.Builder{}
builder.WriteString(info.Main.Version)
if info.Main.Sum != "" {
builder.WriteString(" (checksum: ")
builder.WriteString(info.Main.Sum)
builder.WriteRune(')')
}
return builder.String()
}