mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
Add verbose version flag to list dependencies as well as the version (#34741)
* add verbose version flag to list dependencies as well as the version * Fix typo in the println message Co-authored-by: Arve Knudsen <arve.knudsen@gmail.com> Co-authored-by: Arve Knudsen <arve.knudsen@gmail.com>
This commit is contained in:
parent
32d9b04666
commit
9d33a06b4e
@ -10,6 +10,7 @@ import (
|
|||||||
"os"
|
"os"
|
||||||
"os/signal"
|
"os/signal"
|
||||||
"runtime"
|
"runtime"
|
||||||
|
"runtime/debug"
|
||||||
"runtime/trace"
|
"runtime/trace"
|
||||||
"strconv"
|
"strconv"
|
||||||
"syscall"
|
"syscall"
|
||||||
@ -60,6 +61,7 @@ func main() {
|
|||||||
packaging = flag.String("packaging", "unknown", "describes the way Grafana was installed")
|
packaging = flag.String("packaging", "unknown", "describes the way Grafana was installed")
|
||||||
|
|
||||||
v = flag.Bool("v", false, "prints current version and exits")
|
v = flag.Bool("v", false, "prints current version and exits")
|
||||||
|
vv = flag.Bool("vv", false, "prints current version, all dependencies and exits")
|
||||||
profile = flag.Bool("profile", false, "Turn on pprof profiling")
|
profile = flag.Bool("profile", false, "Turn on pprof profiling")
|
||||||
profilePort = flag.Uint64("profile-port", 6060, "Define custom port for profiling")
|
profilePort = flag.Uint64("profile-port", 6060, "Define custom port for profiling")
|
||||||
tracing = flag.Bool("tracing", false, "Turn on tracing")
|
tracing = flag.Bool("tracing", false, "Turn on tracing")
|
||||||
@ -68,8 +70,16 @@ func main() {
|
|||||||
|
|
||||||
flag.Parse()
|
flag.Parse()
|
||||||
|
|
||||||
if *v {
|
if *v || *vv {
|
||||||
fmt.Printf("Version %s (commit: %s, branch: %s)\n", version, commit, buildBranch)
|
fmt.Printf("Version %s (commit: %s, branch: %s)\n", version, commit, buildBranch)
|
||||||
|
if *vv {
|
||||||
|
fmt.Println("Dependencies:")
|
||||||
|
if info, ok := debug.ReadBuildInfo(); ok {
|
||||||
|
for _, dep := range info.Deps {
|
||||||
|
fmt.Println(dep.Path, dep.Version)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
os.Exit(0)
|
os.Exit(0)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user