app.PrintVersion   A
last analyzed

Complexity

Conditions 2

Size

Total Lines 11
Code Lines 10

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 2
eloc 10
dl 0
loc 11
c 0
b 0
f 0
rs 9.9
nop 0
1
package app
2
3
import (
4
	"encoding/json"
5
	"fmt"
6
	"os"
7
)
8
9
var (
10
	release   = "UNKNOWN"
11
	buildDate = "UNKNOWN"
12
	gitHash   = "UNKNOWN"
13
)
14
15
func PrintVersion() {
16
	if err := json.NewEncoder(os.Stdout).Encode(struct {
17
		Release   string
18
		BuildDate string
19
		GitHash   string
20
	}{
21
		Release:   release,
22
		BuildDate: buildDate,
23
		GitHash:   gitHash,
24
	}); err != nil {
25
		fmt.Printf("error while decode version info: %v\n", err)
26
	}
27
}
28