mirror of
https://github.com/anotherhadi/spilltea.git
synced 2026-05-20 09:42:34 +02:00
add runtime version
Signed-off-by: Hadi <112569860+anotherhadi@users.noreply.github.com>
This commit is contained in:
@@ -5,6 +5,7 @@ import (
|
||||
"net"
|
||||
"os"
|
||||
"path/filepath"
|
||||
"runtime/debug"
|
||||
|
||||
tea "charm.land/bubbletea/v2"
|
||||
spilltea "github.com/anotherhadi/spilltea"
|
||||
@@ -21,6 +22,15 @@ import (
|
||||
// Version is overwritten at build time by goreleaser/ldflag with the current version tag, or "dev" if not set.
|
||||
var version = "dev"
|
||||
|
||||
func init() {
|
||||
if version != "dev" {
|
||||
return
|
||||
}
|
||||
if info, ok := debug.ReadBuildInfo(); ok && info.Main.Version != "" && info.Main.Version != "(devel)" {
|
||||
version = info.Main.Version
|
||||
}
|
||||
}
|
||||
|
||||
func main() {
|
||||
var (
|
||||
flagConfig = flag.StringP("config", "c", "", "path to config file")
|
||||
|
||||
Reference in New Issue
Block a user