From 1e87466ccbe45bd6c4dcc02dd468e17303873fbe Mon Sep 17 00:00:00 2001 From: Gregory Ballantine Date: Wed, 29 May 2024 11:04:31 -0400 Subject: [PATCH] Added Go runtime version to the layout footer --- Makefile | 2 +- app/vars.go | 9 +++++++-- templates/layout/footer.tmpl | 2 +- web/middleware/vars.go | 3 ++- 4 files changed, 11 insertions(+), 5 deletions(-) diff --git a/Makefile b/Makefile index acc992b..fee0341 100644 --- a/Makefile +++ b/Makefile @@ -4,7 +4,7 @@ VERSION=`git describe --tags` .PHONY: build ## build: Compile the packages. build: - @go build -o $(NAME) -ldflags "-X git.metaunix.net/bitgoblin/blt/app.Version=$(VERSION)" + @go build -o $(NAME) -ldflags "-X git.metaunix.net/bitgoblin/blt/app.AppVersion=$(VERSION)" .PHONY: run ## run: Build and Run in development mode. diff --git a/app/vars.go b/app/vars.go index 10f363b..02e1668 100644 --- a/app/vars.go +++ b/app/vars.go @@ -1,5 +1,10 @@ package app -var ( - Version string = "N/a" +import ( + "runtime" +) + +var ( + AppVersion string = "N/a" + RuntimeVersion string = runtime.Version ) diff --git a/templates/layout/footer.tmpl b/templates/layout/footer.tmpl index 46b5892..84e1a06 100644 --- a/templates/layout/footer.tmpl +++ b/templates/layout/footer.tmpl @@ -3,7 +3,7 @@ diff --git a/web/middleware/vars.go b/web/middleware/vars.go index c69f4e3..15390c7 100644 --- a/web/middleware/vars.go +++ b/web/middleware/vars.go @@ -7,5 +7,6 @@ import ( ) func CustomVars(data template.Data) { - data["app_version"] = app.Version + data["app_version"] = app.AppVersion + data["runtime_version"] = app.RuntimeVersion }