diff --git a/pkg/scorecard/scorecard_result.go b/pkg/scorecard/scorecard_result.go index 367638d219bd..595a6bd3fda3 100644 --- a/pkg/scorecard/scorecard_result.go +++ b/pkg/scorecard/scorecard_result.go @@ -157,10 +157,12 @@ func FormatResults( } err = results.AsJSON2(output, doc, o) case options.FormatStatement: - o := &AsJSON2ResultOption{ - Details: opts.ShowDetails, - Annotations: opts.ShowAnnotations, - LogLevel: log.ParseLevel(opts.LogLevel), + o := &AsStatementResultOption{ + AsJSON2ResultOption: AsJSON2ResultOption{ + Details: opts.ShowDetails, + Annotations: opts.ShowAnnotations, + LogLevel: log.ParseLevel(opts.LogLevel), + }, } err = results.AsStatement(output, doc, o) case options.FormatProbe: diff --git a/pkg/scorecard/statement.go b/pkg/scorecard/statement.go index d345cada6989..9e920de31028 100644 --- a/pkg/scorecard/statement.go +++ b/pkg/scorecard/statement.go @@ -40,8 +40,13 @@ type Predicate struct { JSONScorecardResultV2 } +// AsStatementResultOption wraps AsJSON2ResultOption preparing it for +type AsStatementResultOption struct { + AsJSON2ResultOption +} + // AsStatement converts the results as an in-toto statement. -func (r *Result) AsStatement(writer io.Writer, checkDocs docs.Doc, opt *AsJSON2ResultOption) error { +func (r *Result) AsStatement(writer io.Writer, checkDocs docs.Doc, opt *AsStatementResultOption) error { // Build the attestation subject from the result Repo. subject := intoto.ResourceDescriptor{ Name: r.Repo.Name, @@ -51,7 +56,7 @@ func (r *Result) AsStatement(writer io.Writer, checkDocs docs.Doc, opt *AsJSON2R }, } - json2, err := r.resultsToJSON2(checkDocs, opt) + json2, err := r.resultsToJSON2(checkDocs, &opt.AsJSON2ResultOption) if err != nil { return sce.WithMessage(sce.ErrScorecardInternal, err.Error()) }