tenseleyflow/shithub / 8f9236b

Browse files

Add internal/version with -ldflags-injected build info

Authored by mfwolffe <wolffemf@dukes.jmu.edu>
SHA
8f9236b79729f9d42e7cad64de37a2fa63c70101
Parents
c4f851e
Tree
15895b6

1 changed file

StatusFile+-
A internal/version/version.go 22 0
internal/version/version.goadded
@@ -0,0 +1,22 @@
1
+// SPDX-License-Identifier: AGPL-3.0-or-later
2
+
3
+// Package version exposes build-time information embedded via -ldflags.
4
+//
5
+// Values are set by the Makefile at build time:
6
+//
7
+//	-X github.com/tenseleyFlow/shithub/internal/version.Version=...
8
+//	-X github.com/tenseleyFlow/shithub/internal/version.Commit=...
9
+//	-X github.com/tenseleyFlow/shithub/internal/version.BuiltAt=...
10
+package version
11
+
12
+// Build-time injected values. Defaults reflect a non-release `go run` build.
13
+var (
14
+	Version = "dev"
15
+	Commit  = "unknown"
16
+	BuiltAt = "unknown"
17
+)
18
+
19
+// String returns a one-line stamp suitable for `--version` style output.
20
+func String() string {
21
+	return Version + " (" + Commit + ", built " + BuiltAt + ")"
22
+}