From 48c37b5687a6a287d0e1d012bdc47fa3977f19cf Mon Sep 17 00:00:00 2001 From: Alberto Bertogli Date: Fri, 11 Sep 2020 12:34:36 +0100 Subject: [PATCH] monitoring: Show the go version used to build the binary This patch makes the monitoring web server index show the go compiler version used to build the binary, which can be convenient when troubleshooting. --- monitoring.go | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/monitoring.go b/monitoring.go index cb70422..1009bce 100644 --- a/monitoring.go +++ b/monitoring.go @@ -6,6 +6,7 @@ import ( "html/template" "net/http" "os" + "runtime" "time" "blitiri.com.ar/go/chasquid/internal/config" @@ -24,12 +25,14 @@ func launchMonitoringServer(conf *config.Config) { indexData := struct { Version string + GoVersion string SourceDate time.Time StartTime time.Time Config *config.Config Hostname string }{ Version: version, + GoVersion: runtime.Version(), SourceDate: sourceDate, StartTime: time.Now(), Config: conf, @@ -79,12 +82,17 @@ var monitoringHTMLIndex = template.Must(

chasquid @{{.Config.Hostname}}

+

chasquid {{.Version}}
-source date {{.SourceDate.Format "2006-01-02 15:04:05 -0700"}}

+source date {{.SourceDate.Format "2006-01-02 15:04:05 -0700"}}
+built with {{.GoVersion}}
+

+

started {{.StartTime.Format "Mon, 2006-01-02 15:04:05 -0700"}}
up for {{.StartTime | since | roundDuration}}
-os hostname {{.Hostname}}

+os hostname {{.Hostname}}
+