refactor: change the code's whole structure
This commit is contained in:
parent
a659154937
commit
96637019c1
13 changed files with 295 additions and 52 deletions
pkg/version
27
pkg/version/version.go
Normal file
27
pkg/version/version.go
Normal file
|
@ -0,0 +1,27 @@
|
|||
package version // import nocternity.net/go-monitoring/pkg/version
|
||||
|
||||
import "fmt"
|
||||
|
||||
var (
|
||||
version = ""
|
||||
commit = "unknown"
|
||||
status = ""
|
||||
target = "unknown/unknown"
|
||||
)
|
||||
|
||||
func Version() string {
|
||||
var schar, ver string
|
||||
if status == "dirty" {
|
||||
schar = "*"
|
||||
} else {
|
||||
schar = ""
|
||||
}
|
||||
|
||||
if version == "" {
|
||||
ver = "development version"
|
||||
} else {
|
||||
ver = version
|
||||
}
|
||||
|
||||
return fmt.Sprintf("%s (%s%s) %s", ver, commit, schar, target)
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue