mirror of
https://github.com/lyx0/nourybot.git
synced 2024-11-13 19:49:55 +01:00
only use short commit string
This commit is contained in:
parent
ce701c2230
commit
a44cab6b3f
|
@ -7,15 +7,13 @@
|
||||||
package common
|
package common
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
|
||||||
"runtime/debug"
|
"runtime/debug"
|
||||||
)
|
)
|
||||||
|
|
||||||
// GetVersion returns the current git commit hash.
|
// GetVersion returns the current git commit hash.
|
||||||
// If the version is modified the hash ends in "-dirty"
|
|
||||||
func GetVersion() string {
|
func GetVersion() string {
|
||||||
var revision string
|
var revision string
|
||||||
var modified bool
|
var short string
|
||||||
|
|
||||||
bi, ok := debug.ReadBuildInfo()
|
bi, ok := debug.ReadBuildInfo()
|
||||||
if ok {
|
if ok {
|
||||||
|
@ -23,10 +21,7 @@ func GetVersion() string {
|
||||||
switch s.Key {
|
switch s.Key {
|
||||||
case "vcs.revision":
|
case "vcs.revision":
|
||||||
revision = s.Value
|
revision = s.Value
|
||||||
case "vcs.modified":
|
short = revision[:7]
|
||||||
if s.Value == "true" {
|
|
||||||
modified = true
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -35,11 +30,7 @@ func GetVersion() string {
|
||||||
return "unavailable"
|
return "unavailable"
|
||||||
}
|
}
|
||||||
|
|
||||||
if modified {
|
return short
|
||||||
return fmt.Sprintf("%s-dirty", revision)
|
|
||||||
}
|
|
||||||
|
|
||||||
return revision
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// GetVersion returns the current git commit hash.
|
// GetVersion returns the current git commit hash.
|
||||||
|
|
Loading…
Reference in a new issue