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 576a3a3 commit a8e2b7eCopy full SHA for a8e2b7e
meta/version.go
@@ -3,12 +3,13 @@ package meta
3
import (
4
"fmt"
5
"runtime"
6
+ "runtime/debug"
7
)
8
9
var (
10
version = "devel"
11
commit = "-"
- date = "-"
12
+ date = ""
13
14
15
// GetVersion returns the current version.
@@ -18,6 +19,14 @@ func GetVersion() string {
18
19
20
// DisplayVersion Display version information.
21
func DisplayVersion() {
22
+ if info, available := debug.ReadBuildInfo(); available {
23
+ if date == "" {
24
+ version = info.Main.Version
25
+ commit = fmt.Sprintf("(unknown, mod sum: %q)", info.Main.Sum)
26
+ date = "(unknown)"
27
+ }
28
29
+
30
fmt.Printf(`prm:
31
version : %s
32
commit : %s
0 commit comments