aboutsummaryrefslogtreecommitdiffhomepage
path: root/internal/info/version.go
blob: 5e3e6aac659e5df310f35960d5bd2110700654ca (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
// Package info holds metadata populated at link time.
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
}