From 9cc869bb1ccd401ef870d18ff0e28e1aff8500fe Mon Sep 17 00:00:00 2001 From: Wade Simmons Date: Mon, 14 Apr 2025 11:32:52 -0400 Subject: [PATCH] also default in the library --- main.go | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/main.go b/main.go index b278fa6..0cbf2d9 100644 --- a/main.go +++ b/main.go @@ -5,6 +5,8 @@ import ( "fmt" "net" "net/netip" + "runtime/debug" + "strings" "time" "github.com/sirupsen/logrus" @@ -27,6 +29,14 @@ 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") + } + } + l := logger l.Formatter = &logrus.TextFormatter{ FullTimestamp: true,