Skip to content

Commit 78c406d

Browse files
loop: add commit_hash to --version output
The `commit_hash` field will contain the full commit hash of the commit that build was based on.
1 parent cdcacfe commit 78c406d

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

version.go

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -64,10 +64,14 @@ func Version() string {
6464

6565
// RichVersion returns the application version as a properly formed string
6666
// per the semantic versioning 2.0.0 spec (http://semver.org/), followed by the
67-
// most recent git tag the build was built on.
67+
// most recent git tag and commit hash the build was built on.
6868
func RichVersion() string {
69-
// Append the most recent git tag of the current build to version.
70-
return fmt.Sprintf("%s commit=%s", semanticVersion(), Commit)
69+
// Append the most recent git tag and commit hash of the current build
70+
// to version.
71+
return fmt.Sprintf(
72+
"%s commit=%s commit_hash=%s", semanticVersion(), Commit,
73+
CommitHash,
74+
)
7175
}
7276

7377
// UserAgent returns the full user agent string that identifies the software

0 commit comments

Comments
 (0)