()
| 26 | } |
| 27 | |
| 28 | func resolveVersionFromBuildInfo() { |
| 29 | if version != "dev" { |
| 30 | return |
| 31 | } |
| 32 | info, ok := debug.ReadBuildInfo() |
| 33 | if !ok { |
| 34 | return |
| 35 | } |
| 36 | if info.Main.Version != "" && info.Main.Version != "(devel)" { |
| 37 | version = info.Main.Version |
| 38 | } |
| 39 | for _, s := range info.Settings { |
| 40 | switch s.Key { |
| 41 | case "vcs.revision": |
| 42 | if len(s.Value) > 8 { |
| 43 | commit = s.Value[:8] |
| 44 | } else if s.Value != "" { |
| 45 | commit = s.Value |
| 46 | } |
| 47 | case "vcs.time": |
| 48 | if s.Value != "" { |
| 49 | buildDate = s.Value |
| 50 | } |
| 51 | } |
| 52 | } |
| 53 | } |