From f07cddce02bf2b30b729c0b6873a610cf2672e4c Mon Sep 17 00:00:00 2001 From: Rob Scott Date: Mon, 25 Mar 2019 12:33:24 -0400 Subject: [PATCH] fixes for golint errors --- pkg/dashboard/dashboard.go | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/pkg/dashboard/dashboard.go b/pkg/dashboard/dashboard.go index 5d59d3776..2a0c36271 100644 --- a/pkg/dashboard/dashboard.go +++ b/pkg/dashboard/dashboard.go @@ -10,8 +10,13 @@ import ( "github.com/reactiveops/fairwinds/pkg/validator" ) -const TEMPLATE_NAME = "dashboard.gohtml" -const TEMPLATE_FILE = "pkg/dashboard/templates/" + TEMPLATE_NAME +const ( + // TemplateName references the dashboard template to use + TemplateName = "dashboard.gohtml" + + // TemplateFile references the path of the dashboard template to use + TemplateFile = "pkg/dashboard/templates/" + TemplateName +) // TemplateData represents data in a format that's template friendly. type TemplateData struct { @@ -26,7 +31,7 @@ func MainHandler(w http.ResponseWriter, r *http.Request, c conf.Configuration, k http.Error(w, "Error Fetching Deployments", 500) return } - tmpl, err := template.New(TEMPLATE_NAME).Funcs(template.FuncMap{ + tmpl, err := template.New(TemplateName).Funcs(template.FuncMap{ "getWarningWidth": func(rs validator.ResultSummary, fullWidth int) uint { return uint(float64(rs.Successes+rs.Warnings) / float64(rs.Successes+rs.Warnings+rs.Failures) * float64(fullWidth)) }, @@ -43,7 +48,7 @@ func MainHandler(w http.ResponseWriter, r *http.Request, c conf.Configuration, k return "fas fa-times" } }, - }).ParseFiles(TEMPLATE_FILE) + }).ParseFiles(TemplateFile) if err != nil { http.Error(w, err.Error(), http.StatusInternalServerError) return