INNER CODE UNIT · Go
getCommit
arp242/goatcounter · context.go:22
func getCommit() (string, time.Time, bool) {
var (
rev string
last time.Time
dirty bool
info, _ = debug.ReadBuildInfo()
)
for _, kv := range info.Settings {
switch kv.Key {
case "vcs.revision":
rev = kv.Value
case "vcs.time":
last, _ = time.Parse(time.RFC3339, kv.Value)
case "vcs.modified":
dirty = kv.Value == "true"
}
}
return rev, last, dirty