getBuildInfo returns the Go version and Git commit hash.
()
| 129 | |
| 130 | // getBuildInfo returns the Go version and Git commit hash. |
| 131 | func getBuildInfo() (string, string) { |
| 132 | gover := runtime.Version() |
| 133 | |
| 134 | if info, ok := debug.ReadBuildInfo(); ok { |
| 135 | for _, setting := range info.Settings { |
| 136 | if setting.Key == "vcs.revision" { |
| 137 | return gover, setting.Value |
| 138 | } |
| 139 | } |
| 140 | } |
| 141 | |
| 142 | return gover, "" |
| 143 | } |
| 144 | |
| 145 | // generateErrorHTML renders the error page template with the given error information. |
| 146 | // It returns the generated HTML as a byte slice and a Content-Type string. |