diff options
Diffstat (limited to 'pkg/html/html.go')
| -rw-r--r-- | pkg/html/html.go | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/pkg/html/html.go b/pkg/html/html.go index 6d24ba7e7..0b6fdaa75 100644 --- a/pkg/html/html.go +++ b/pkg/html/html.go @@ -8,6 +8,7 @@ package html import ( "fmt" "html/template" + "reflect" "strings" texttemplate "text/template" "time" @@ -46,6 +47,7 @@ var Funcs = template.FuncMap{ "formatCommitTableTitle": formatCommitTableTitle, "formatList": formatStringList, "selectBisect": selectBisect, + "dereference": dereferencePointer, } func selectBisect(rep *dashapi.BugReport) *dashapi.BisectResult { @@ -180,3 +182,14 @@ func formatCommitTableTitle(v string) string { func formatStringList(list []string) string { return strings.Join(list, ", ") } + +func dereferencePointer(v interface{}) interface{} { + reflectValue := reflect.ValueOf(v) + if !reflectValue.IsNil() && reflectValue.Kind() == reflect.Ptr { + elem := reflectValue.Elem() + if elem.CanInterface() { + return elem.Interface() + } + } + return v +} |
