From 766dd89ffa198a315b043230f904636461c41efe Mon Sep 17 00:00:00 2001 From: Ophestra Date: Tue, 21 Oct 2025 01:49:36 +0900 Subject: internal: clean up build strings These names are less ambiguous and should be understandable without reading the source code. Signed-off-by: Ophestra --- internal/version.go | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100644 internal/version.go (limited to 'internal/version.go') diff --git a/internal/version.go b/internal/version.go new file mode 100644 index 00000000..5c671084 --- /dev/null +++ b/internal/version.go @@ -0,0 +1,19 @@ +package internal + +// 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