refactor: change the code's whole structure

This commit is contained in:
Emmanuel BENOîT 2024-07-19 14:29:51 +02:00
parent a659154937
commit 96637019c1
Signed by: Emmanuel BENOîT
SSH key fingerprint: SHA256:l7PFUUF5TCDsvYeQC9OnTNz08dFY7Fvf4Hv3neIqYpg
13 changed files with 295 additions and 52 deletions
pkg/version

27
pkg/version/version.go Normal file
View 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)
}