gitlin/utils/version.go

20 行
441 B
Go
Raw 通常表示 履歴

package utils
import (
2023-06-06 20:25:00 +09:00
"runtime/debug"
)
var Branch = "Alpha"
// Version returns the git commit hash of the current build. Taken from https://git.vern.cc/pjals/bestofbot.
func Version() string {
2023-06-06 20:25:00 +09:00
if info, ok := debug.ReadBuildInfo(); ok {
for _, setting := range info.Settings {
if setting.Key == "vcs.revision" {
return setting.Value[:8]
}
}
}
return "unknown, please build with Go 1.13+ or use Git"
}