git » chasquid » commit 48c37b5

monitoring: Show the go version used to build the binary

author Alberto Bertogli
2020-09-11 11:34:36 UTC
committer Alberto Bertogli
2020-09-11 11:34:36 UTC
parent a2ce7c73238833d439e7baac377b541f62e3ffcd

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 +10 -2

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(
 <body>
 <h1>chasquid @{{.Config.Hostname}}</h1>
 
+<p>
 chasquid {{.Version}}<br>
-source date {{.SourceDate.Format "2006-01-02 15:04:05 -0700"}}<p>
+source date {{.SourceDate.Format "2006-01-02 15:04:05 -0700"}}<br>
+built with {{.GoVersion}}<br>
+</p>
 
+<p>
 started {{.StartTime.Format "Mon, 2006-01-02 15:04:05 -0700"}}<br>
 up for {{.StartTime | since | roundDuration}}<br>
-os hostname <i>{{.Hostname}}</i><p>
+os hostname <i>{{.Hostname}}</i><br>
+</p>
 
 <ul>
   <li><a href="/debug/queue">queue</a>