Skip to content

Commit db86b5c

Browse files
committed
Initialize results data in result.Initialize()
It seems like the behavior that would be expected from the function.
1 parent 521507f commit db86b5c

File tree

2 files changed

+2
-1
lines changed

2 files changed

+2
-1
lines changed

Diff for: result/result.go

+1
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,7 @@ type summaryReportType struct {
8383

8484
// Initialize adds the tool configuration data to the results data.
8585
func (results *Type) Initialize() {
86+
*results = *new(Type)
8687
results.Configuration = toolConfigurationReportType{
8788
Paths: configuration.TargetPaths(),
8889
ProjectType: configuration.SuperprojectTypeFilter().String(),

Diff for: result/result_test.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -69,8 +69,8 @@ func TestRecord(t *testing.T) {
6969
assert.Equal(t, "", "", summaryText, "Non-failure result with no check function output should result in an empty summary")
7070

7171
checkResult := checkresult.Pass
72-
results = Type{}
7372

73+
results.Initialize()
7474
results.Record(checkedProject, checkConfiguration, checkResult, checkOutput)
7575
projectReport := results.Projects[0]
7676
assert.Equal(t, checkedProject.Path, projectReport.Path)

0 commit comments

Comments
 (0)