28 lines
427 B
Go
28 lines
427 B
Go
|
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)
|
||
|
}
|