mirror of https://github.com/rkfg/regolancer
parent
9e2e01487f
commit
f59d2466e5
@ -0,0 +1,28 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"os"
|
||||
"runtime/debug"
|
||||
)
|
||||
|
||||
func printVersion() {
|
||||
info, ok := debug.ReadBuildInfo()
|
||||
if !ok {
|
||||
fmt.Printf("No build info available")
|
||||
} else {
|
||||
settings := map[string]string{}
|
||||
for _, bs := range info.Settings {
|
||||
settings[bs.Key] = bs.Value
|
||||
}
|
||||
version := info.Main.Version
|
||||
if rev, ok := settings["vcs.revision"]; ok && version == "(devel)" {
|
||||
version = "git" + rev[:8]
|
||||
}
|
||||
if settings["vcs.modified"] == "true" {
|
||||
version += "-dirty"
|
||||
}
|
||||
fmt.Printf("Regolancer %s, built with %s\nSource: https://github.com/rkfg/regolancer\n", version, info.GoVersion)
|
||||
}
|
||||
os.Exit(1)
|
||||
}
|
Loading…
Reference in New Issue