From d274ee41cb8d1e28cc65d1befe0cb7db14f973d8 Mon Sep 17 00:00:00 2001 From: Job Snijders Date: Tue, 6 Aug 2024 14:44:39 +0000 Subject: [PATCH] Manually set the version into the apps It appears that Go's method of feeding in the actual version highly depends on whether you build via make or via some other pipeline. Hardcoding the application's version number in 1 place seems a reasonable approach --- cmd/rtrdump/rtrdump.go | 4 +--- cmd/rtrmon/rtrmon.go | 4 +--- cmd/stayrtr/stayrtr.go | 4 +--- lib/structs.go | 2 ++ 4 files changed, 5 insertions(+), 9 deletions(-) diff --git a/cmd/rtrdump/rtrdump.go b/cmd/rtrdump/rtrdump.go index 1464b52..73ffef9 100644 --- a/cmd/rtrdump/rtrdump.go +++ b/cmd/rtrdump/rtrdump.go @@ -27,9 +27,7 @@ const ( ) var ( - version = "" - buildinfos = "" - AppVersion = "RTRdump " + version + " " + buildinfos + AppVersion = "RTRdump " + rtr.APP_VERSION Connect = flag.String("connect", "127.0.0.1:8282", "Connection address") OutFile = flag.String("file", "output.json", "Output file") diff --git a/cmd/rtrmon/rtrmon.go b/cmd/rtrmon/rtrmon.go index 982a990..fdc7674 100644 --- a/cmd/rtrmon/rtrmon.go +++ b/cmd/rtrmon/rtrmon.go @@ -42,9 +42,7 @@ const ( type thresholds []int64 var ( - version = "" - buildinfos = "" - AppVersion = "RTRmon " + version + " " + buildinfos + AppVersion = "RTRmon " + rtr.APP_VERSION //go:embed index.html.tmpl IndexTemplate string diff --git a/cmd/stayrtr/stayrtr.go b/cmd/stayrtr/stayrtr.go index cbcbc5a..11a34c8 100644 --- a/cmd/stayrtr/stayrtr.go +++ b/cmd/stayrtr/stayrtr.go @@ -44,9 +44,7 @@ const ( ) var ( - version = "" - buildinfos = "" - AppVersion = "StayRTR " + version + " " + buildinfos + AppVersion = "StayRTR " + rtr.APP_VERSION MetricsAddr = flag.String("metrics.addr", ":9847", "Metrics address") MetricsPath = flag.String("metrics.path", "/metrics", "Metrics path") diff --git a/lib/structs.go b/lib/structs.go index 8dfb614..e4cd241 100644 --- a/lib/structs.go +++ b/lib/structs.go @@ -19,6 +19,8 @@ type Logger interface { } const ( + APP_VERSION = "0.6.0" + // We use the size of the largest sensible PDU. // // We ignore the theoretically unbounded length of SKIs for router keys.