28 lines
421 B
Go
28 lines
421 B
Go
|
package version // import nocternity.net/gomonop/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)
|
||
|
}
|