style: shorten receiver names in HTML Printer

This commit is contained in:
Vlad Klokun
2022-12-22 15:00:59 +02:00
committed by Vlad Klokun
parent 116aee0c9c
commit 8f3af71c84
@@ -38,17 +38,17 @@ func NewHtmlPrinter() *HtmlPrinter {
return &HtmlPrinter{}
}
func (htmlPrinter *HtmlPrinter) SetWriter(outputFile string) {
func (hp *HtmlPrinter) SetWriter(outputFile string) {
if strings.TrimSpace(outputFile) == "" {
outputFile = htmlOutputFile
}
if filepath.Ext(strings.TrimSpace(outputFile)) != htmlOutputExt {
outputFile = outputFile + htmlOutputExt
}
htmlPrinter.writer = printer.GetWriter(outputFile)
hp.writer = printer.GetWriter(outputFile)
}
func (htmlPrinter *HtmlPrinter) ActionPrint(opaSessionObj *cautils.OPASessionObj) {
func (hp *HtmlPrinter) ActionPrint(opaSessionObj *cautils.OPASessionObj) {
tplFuncMap := template.FuncMap{
"sum": func(nums ...int) int {
total := 0
@@ -104,16 +104,16 @@ func (htmlPrinter *HtmlPrinter) ActionPrint(opaSessionObj *cautils.OPASessionObj
resourceTableView := buildResourceTableView(opaSessionObj)
reportingCtx := HTMLReportingCtx{opaSessionObj, resourceTableView}
err := tpl.Execute(htmlPrinter.writer, reportingCtx)
err := tpl.Execute(hp.writer, reportingCtx)
if err != nil {
logger.L().Error("failed to render template", helpers.Error(err))
} else {
printer.LogOutputFile(htmlPrinter.writer.Name())
printer.LogOutputFile(hp.writer.Name())
}
}
func (htmlPrinter *HtmlPrinter) Score(score float32) {
func (hp *HtmlPrinter) Score(score float32) {
return
}