| 12345678910111213141516171819202122232425262728293031323334353637 |
- package main
- import "runtime/debug"
- // version is the release number shown on the About page. Bump it in the PR
- // that makes a user-visible change.
- const version = "0.5.3"
- // commitInfo is the git revision `go build` stamped into the binary. Full is
- // empty when the binary was built outside a git checkout (for example by
- // `go test`); Dirty means the tree had uncommitted changes, so the build
- // doesn't match any commit exactly.
- type commitInfo struct {
- Full, Short string
- Dirty bool
- }
- func buildCommit() commitInfo {
- info, ok := debug.ReadBuildInfo()
- if !ok {
- return commitInfo{}
- }
- var c commitInfo
- for _, s := range info.Settings {
- switch s.Key {
- case "vcs.revision":
- c.Full = s.Value
- case "vcs.modified":
- c.Dirty = s.Value == "true"
- }
- }
- c.Short = c.Full
- if len(c.Short) > 7 {
- c.Short = c.Short[:7]
- }
- return c
- }
|