buildRevision is the commit ghmock was built from, if Go recorded it.
()
| 219 | |
| 220 | // buildRevision is the commit ghmock was built from, if Go recorded it. |
| 221 | func buildRevision() string { |
| 222 | info, ok := debug.ReadBuildInfo() |
| 223 | if !ok { |
| 224 | return "" |
| 225 | } |
| 226 | var revision string |
| 227 | modified := false |
| 228 | for _, s := range info.Settings { |
| 229 | switch s.Key { |
| 230 | case "vcs.revision": |
| 231 | revision = s.Value |
| 232 | case "vcs.modified": |
| 233 | modified = s.Value == "true" |
| 234 | } |
| 235 | } |
| 236 | if revision != "" && modified { |
| 237 | revision += ", with local changes" |
| 238 | } |
| 239 | return revision |
| 240 | } |