terminal: add commit_hash to --version output

The `commit_hash` field will contain the full commit hash of the commit
that build was based on.
This commit is contained in:
Viktor Tigerström 2025-05-13 12:10:32 +02:00
parent e30ac3d0a8
commit 4edaed4297
No known key found for this signature in database
GPG key ID: B984570980684DCC

View file

@ -48,12 +48,13 @@ func Version() string {
}
// RichVersion returns the application version as a properly formed string
// per the semantic versioning 2.0.0 spec (http://semver.org/), the git tag it
// was built on.
// per the semantic versioning 2.0.0 spec (http://semver.org/), the git tag and
// commit hash it was built on.
func RichVersion() string {
// Append git tag of current build to version.
// Append git tag and commit hash of current build to version.
return fmt.Sprintf(
"%s commit=%s", semanticVersion(), Commit,
"%s commit=%s commit_hash=%s", semanticVersion(), Commit,
CommitHash,
)
}