lockserver/config/version.go
Finn 060b5705c8
All checks were successful
/ build-container (push) Successful in 8m0s
Fix version
2024-11-23 17:01:50 -08:00

30 lines
421 B
Go

package config
import (
"runtime/debug"
"github.com/sirupsen/logrus"
)
var (
BuildInfo *debug.BuildInfo
Version string
)
func init() {
var ok bool
BuildInfo, ok = debug.ReadBuildInfo()
if !ok {
logrus.Error("failed to read build info")
return
}
if Version == "" {
for _, setting := range BuildInfo.Settings {
if setting.Key == "vcs.revision" {
Version = setting.Value
break
}
}
}
}