package view import ( "html/template" "strings" "time" ) func formatDate(date time.Time) string { return date.Format("Jan _2, 2006") } func formatDateLong(date time.Time) string { return date.Format("Jan _2, 2006 15:04 MST") } func formatUserID(userid string) string { split := strings.SplitN(userid, ":", 2) return split[len(split)-1] } var funcMap = template.FuncMap{ "formatDate": formatDate, "formatDateLong": formatDateLong, "formatUserID": formatUserID, "tolower": strings.ToLower, }