mirror of
https://github.com/gocsaf/csaf.git
synced 2025-12-22 18:15:42 +01:00
Merge pull request #80 from csaf-poc/checker-documentation
Checker documentation
This commit is contained in:
commit
45ac434871
3 changed files with 65 additions and 0 deletions
|
|
@ -38,6 +38,8 @@ func errCheck(err error) {
|
|||
}
|
||||
}
|
||||
|
||||
// writeJSON writes the JSON encoding of the given report to the given stream.
|
||||
// It returns nil, otherwise an error.
|
||||
func writeJSON(report *Report, w io.WriteCloser) error {
|
||||
enc := json.NewEncoder(w)
|
||||
enc.SetIndent("", " ")
|
||||
|
|
@ -48,6 +50,8 @@ func writeJSON(report *Report, w io.WriteCloser) error {
|
|||
return err
|
||||
}
|
||||
|
||||
// writeHTML writes the given report to the given writer, it uses the template
|
||||
// in the "reportHTML" variable. It returns nil, otherwise an error.
|
||||
func writeHTML(report *Report, w io.WriteCloser) error {
|
||||
tmpl, err := template.New("Report HTML").Parse(reportHTML)
|
||||
if err != nil {
|
||||
|
|
@ -72,6 +76,8 @@ type nopCloser struct{ io.Writer }
|
|||
|
||||
func (nc *nopCloser) Close() error { return nil }
|
||||
|
||||
// writeReport defines where to write the report according to the "output" flag option.
|
||||
// It calls also the "writeJSON" or "writeHTML" function according to the "format" flag option.
|
||||
func writeReport(report *Report, opts *options) error {
|
||||
|
||||
var w io.WriteCloser
|
||||
|
|
@ -98,6 +104,8 @@ func writeReport(report *Report, opts *options) error {
|
|||
return writer(report, w)
|
||||
}
|
||||
|
||||
// buildReporters initializes each report by assigning a number and description to it.
|
||||
// It returns an array of the reporter interface type.
|
||||
func buildReporters() []reporter {
|
||||
return []reporter{
|
||||
&tlsReporter{baseReporter{num: 3, description: "TLS"}},
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue