blob: c4aa677bab50b7109da5e2fcca6e0db16d2fd533 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
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
|