summaryrefslogtreecommitdiffstats
path: root/0002-Set-version-information-at-build.patch
diff options
context:
space:
mode:
Diffstat (limited to '0002-Set-version-information-at-build.patch')
-rw-r--r--0002-Set-version-information-at-build.patch40
1 files changed, 40 insertions, 0 deletions
diff --git a/0002-Set-version-information-at-build.patch b/0002-Set-version-information-at-build.patch
new file mode 100644
index 0000000..c4aa677
--- /dev/null
+++ b/0002-Set-version-information-at-build.patch
@@ -0,0 +1,40 @@
+From f38b2c15ae796ade9f9779974dc5c237597b0829 Mon Sep 17 00:00:00 2001
+From: Leonardo Bishop <me@leonardobishop.net>
+Date: Thu, 7 Aug 2025 18:00:34 +0100
+Subject: [PATCH 2/2] Set version information at build
+
+---
+ Makefile | 6 +++++-
+ walrss/internal/core/version.go | 2 +-
+ 2 files changed, 6 insertions(+), 2 deletions(-)
+
+diff --git a/Makefile b/Makefile
+index 93f2b71..a3300fb 100644
+--- a/Makefile
++++ b/Makefile
+@@ -1,8 +1,12 @@
+ .PHONY: dockerBuild
+
++VERSION := $(shell git describe --tags --abbrev=7 | sed "s/^v//")
++
++all: build
++
+ build: templates
+ mkdir -p bin
+- go build -o bin/walrss github.com/codemicro/walrss/walrss
++ go build -ldflags "-X 'github.com/codemicro/walrss/walrss/internal/core.Version=${VERSION}'" -o bin/walrss github.com/codemicro/walrss/walrss
+
+ run: build
+ mkdir -p run
+diff --git a/walrss/internal/core/version.go b/walrss/internal/core/version.go
+index 0b535ea..00a83ad 100644
+--- a/walrss/internal/core/version.go
++++ b/walrss/internal/core/version.go
+@@ -1,3 +1,3 @@
+ package core
+
+-const Version = ""
++var Version = ""
+--
+2.50.1
+