From 59c4afc5aec84c386a5b5057283dee6f31683fad Mon Sep 17 00:00:00 2001 From: naveensrinivasan <172697+naveensrinivasan@users.noreply.github.com> Date: Sat, 26 Feb 2022 20:53:05 +0000 Subject: [PATCH] :sparkles: Changed jsonScorecardResultV2 type Public - Fixes https://github.com/ossf/scorecard/issues/1673 --- 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) }