Skip to content

Commit

Permalink
feat(common): git hash info func
Browse files Browse the repository at this point in the history
  • Loading branch information
joremysh committed Nov 8, 2024
1 parent 3b853d0 commit b8431cc
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions version/version.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
package version

import "runtime/debug"

var Commit = func() string {
if info, ok := debug.ReadBuildInfo(); ok {
for _, setting := range info.Settings {
if setting.Key == "vcs.revision" {
return setting.Value
}
}
}
return ""
}()

0 comments on commit b8431cc

Please sign in to comment.