From be0e387ab07c7d9f1441365a05c4c0141779184a Mon Sep 17 00:00:00 2001 From: Ophestra Date: Thu, 13 Nov 2025 07:29:46 +0900 Subject: internal/info: relocate from internal This is cleaner and makes more sense. The longer LDFLAGS was never a valid concern since it is always inserted by a script. Signed-off-by: Ophestra --- internal/info/version.go | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100644 internal/info/version.go (limited to 'internal/info/version.go') diff --git a/internal/info/version.go b/internal/info/version.go new file mode 100644 index 00000000..8e722f78 --- /dev/null +++ b/internal/info/version.go @@ -0,0 +1,19 @@ +package info + +// FallbackVersion is returned when a version string was not set by the linker. +const FallbackVersion = "dirty" + +// buildVersion is the Hakurei tree's version string at build time. +// +// This is set by the linker. +var buildVersion string + +// Version returns the Hakurei tree's version string. +// It is either the value of the constant [FallbackVersion] or, +// when possible, a release tag like "v1.0.0". +func Version() string { + if buildVersion != "" { + return buildVersion + } + return FallbackVersion +} -- cgit v1.3.1