File tree Expand file tree Collapse file tree 1 file changed +18
-7
lines changed Expand file tree Collapse file tree 1 file changed +18
-7
lines changed Original file line number Diff line number Diff line change 11package core
22
33import (
4+ "encoding/json"
45 "io/ioutil"
56 "net/http"
67 "os"
@@ -14,13 +15,23 @@ import (
1415)
1516
1617type BuildInfo struct {
17- Version * version.Version
18- BuildDate string
19- GoVersion string
20- GitBranch string
21- GitCommit string
22- GoArch string
23- GoOS string
18+ Version * version.Version `json:"-"`
19+ BuildDate string `json:"build_date"`
20+ GoVersion string `json:"go_version"`
21+ GitBranch string `json:"git_branch"`
22+ GitCommit string `json:"git_commit"`
23+ GoArch string `json:"go_arch"`
24+ GoOS string `json:"go_os"`
25+ }
26+
27+ func (b * BuildInfo ) MarshalJSON () ([]byte , error ) {
28+ type Tmp BuildInfo
29+ return json .Marshal (
30+ struct {
31+ Tmp
32+ Version string `json:"version"`
33+ }{Tmp (* b ), b .Version .String ()},
34+ )
2435}
2536
2637const (
You can’t perform that action at this time.
0 commit comments