This commit is contained in:
Wade Simmons 2025-04-14 11:37:13 -04:00
parent 9cc869bb1c
commit 8f0892ce4b

21
main.go
View File

@ -29,12 +29,8 @@ func Main(c *config.C, configTest bool, buildVersion string, logger *logrus.Logg
}
}()
// Default to the module version for buildVersion
if buildVersion == "" {
info, ok := debug.ReadBuildInfo()
if ok {
buildVersion = strings.TrimPrefix(info.Main.Version, "v")
}
buildVersion = moduleVersion()
}
l := logger
@ -308,3 +304,18 @@ func Main(c *config.C, configTest bool, buildVersion string, logger *logrus.Logg
lightHouse.StartUpdateWorker,
}, nil
}
func moduleVersion() string {
info, ok := debug.ReadBuildInfo()
if !ok {
return ""
}
for _, dep := range info.Deps {
if dep.Path == "github.com/slackhq/nebula" {
return strings.TrimPrefix(dep.Version, "v")
}
}
return ""
}