1
0
mirror of https://github.com/securego/gosec.git synced 2025-03-19 21:08:30 +02:00
gosec/report/html/writer.go

25 lines
424 B
Go
Raw Normal View History

package html
import (
2021-11-15 16:17:22 +01:00
// use go embed to import template
_ "embed"
"html/template"
"io"
2021-05-20 10:16:42 +02:00
"github.com/securego/gosec/v2"
)
2021-11-15 16:17:22 +01:00
//go:embed template.html
var templateContent string
// WriteReport write a report in html format to the output writer
2021-05-20 10:16:42 +02:00
func WriteReport(w io.Writer, data *gosec.ReportInfo) error {
t, e := template.New("gosec").Parse(templateContent)
if e != nil {
return e
}
return t.Execute(w, data)
}