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 <cat@gensokyo.uk>
This commit is contained in:
2025-11-13 07:29:46 +09:00
parent abeb67964f
commit be0e387ab0
10 changed files with 25 additions and 25 deletions

19
internal/info/version.go Normal file
View File

@@ -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
}