From ddb0fe3f31003539681cd6560f8f1605a0411dd9 Mon Sep 17 00:00:00 2001 From: Naveen <172697+naveensrinivasan@users.noreply.github.com> Date: Mon, 28 Feb 2022 14:20:07 -0600 Subject: [PATCH] :sparkles: Changed jsonScorecardResultV2 type Public (#1682) * :sparkles: Changed jsonScorecardResultV2 type Public - Fixes https://github.com/ossf/scorecard/issues/1673 * Update pkg/json.go Co-authored-by: Stephen Augustus (he/him) * Fixed the govet warning by including nolint Fixed the govet linter warning by including nolint. Co-authored-by: Stephen Augustus (he/him) --- pkg/json.go | 5 +++-- pkg/json_test.go | 2 +- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/pkg/json.go b/pkg/json.go index a59a66ccf38..12e3d0b4990 100644 --- a/pkg/json.go +++ b/pkg/json.go @@ -72,7 +72,8 @@ func (s jsonFloatScore) MarshalJSON() ([]byte, error) { } //nolint:govet -type jsonScorecardResultV2 struct { +// JSONScorecardResultV2 exports results as JSON for new detail format. +type JSONScorecardResultV2 struct { Date string `json:"date"` Repo jsonRepoV2 `json:"repo"` Scorecard jsonScorecardV2 `json:"scorecard"` @@ -125,7 +126,7 @@ func (r *ScorecardResult) AsJSON2(showDetails bool, } encoder := json.NewEncoder(writer) - out := jsonScorecardResultV2{ + out := JSONScorecardResultV2{ Repo: jsonRepoV2{ Name: r.Repo.Name, Commit: r.Repo.CommitSHA, diff --git a/pkg/json_test.go b/pkg/json_test.go index a26684ebafc..7060d3a1f7d 100644 --- a/pkg/json_test.go +++ b/pkg/json_test.go @@ -453,7 +453,7 @@ func TestJSONOutput(t *testing.T) { // the calls to Unmarshall() and Marshall() below. // Unmarshall expected output. - var js jsonScorecardResultV2 + var js JSONScorecardResultV2 if err := json.Unmarshal(expected.Bytes(), &js); err != nil { t.Fatalf("%s: json.Unmarshal: %s", tt.name, err) }