We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 85b1d8b commit 620453eCopy full SHA for 620453e
mackerel-check.go
@@ -8,6 +8,7 @@ import (
8
"path/filepath"
9
"regexp"
10
"runtime"
11
+ "runtime/debug"
12
"strings"
13
)
14
@@ -60,11 +61,25 @@ func run(args []string) int {
60
61
return exitOK
62
}
63
-const version = "0.48.0"
64
-
65
-var gitcommit string
+func fromVCS() (version, rev string) {
+ version = "unknown"
66
+ rev = "unknown"
67
+ info, ok := debug.ReadBuildInfo()
68
+ if !ok {
69
+ return
70
+ }
71
+ version = info.Main.Version
72
+ for _, s := range info.Settings {
73
+ if s.Key == "vcs.revision" {
74
+ rev = s.Value
75
76
77
78
79
+}
80
81
func printHelp() {
82
+ version, gitcommit := fromVCS()
83
fmt.Printf(`mackerel-check %s (rev %s) [%s %s %s]
84
85
Usage: mackerel-check <plugin> [<args>]
0 commit comments