What is Nostr?
Louis :emacs: /
npub1tp9…dzfn
2024-07-04 11:21:17

Louis :emacs: on Nostr: TIL: Go 1.18+ can read the Git revision the binary was built from during runtime: var ...

TIL: Go 1.18+ can read the Git revision the binary was built from during runtime:

var commit = func() string {
if info, ok := debug.ReadBuildInfo(); ok {
for _, setting := range info.Settings {
if setting.Key == "vcs.revision" {
return setting.Value
}
}
}
return ""
}()
fmt.Printf("Git Rev. %s\n", commit)


Very useful to print the revision on startup to make sure you are actually using the right version.

#golang
Author Public Key
npub1tp9e9qhmc02khh3jzpn8vmqwhj3u25yw352ed2x87zs4e2ps2uwqhadzfn