Skip to content

Commit 361c328

Browse files
committed
Cleanup of errors
1 parent ce9b965 commit 361c328

File tree

1 file changed

+33
-3
lines changed

1 file changed

+33
-3
lines changed

pkg/reports/standard_report.go

Lines changed: 33 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,12 @@ func (sr *StandardReport) Run(config report.RunConfig) report.Result {
5555
Sections: make([]report.ResultSection, len(sr.sections)),
5656
}
5757

58+
// archiveResult stores all results for archiving, including suppressed errors
59+
archiveResult := report.Result{
60+
Version: version.FullVersionName,
61+
Sections: make([]report.ResultSection, len(sr.sections)),
62+
}
63+
5864
// Initialize the progress indicator
5965
progress := newProgress(sr.checkCount(), os.Stderr)
6066

@@ -64,6 +70,7 @@ func (sr *StandardReport) Run(config report.RunConfig) report.Result {
6470
for i, section := range sr.sections {
6571

6672
sectionResults := []check.Result{}
73+
archivedSectionResults := []check.Result{}
6774

6875
for _, currentCheck := range section.Checks {
6976
// Update text in progress display
@@ -87,7 +94,25 @@ func (sr *StandardReport) Run(config report.RunConfig) report.Result {
8794
}() // async
8895

8996
// Add the results to the report section
90-
sectionResults = append(sectionResults, <-resultsChan...)
97+
checkResults := <-resultsChan
98+
sectionResults = append(sectionResults, checkResults...)
99+
100+
// For the archive, always run with VerboseErrors=true to get all errors
101+
resultsChan = make(chan []check.Result)
102+
go func() {
103+
resultsChan <- currentCheck.Run(
104+
&check.RunContext{
105+
ContainerID: config.ContainerID,
106+
Since: config.Since,
107+
OutputStore: sr.outputStore,
108+
ContainerRuntimeAvailability: containerRuntimeAvailability,
109+
VerboseErrors: true,
110+
},
111+
)
112+
}() // async
113+
114+
archivedCheckResults := <-resultsChan
115+
archivedSectionResults = append(archivedSectionResults, archivedCheckResults...)
91116

92117
// Increment progress
93118
progress.Add(1)
@@ -97,12 +122,17 @@ func (sr *StandardReport) Run(config report.RunConfig) report.Result {
97122
Title: section.Title,
98123
Results: sectionResults,
99124
}
125+
126+
archiveResult.Sections[i] = report.ResultSection{
127+
Title: section.Title,
128+
Results: archivedSectionResults,
129+
}
100130
}
101131

102132
progress.Finish()
103133

104-
// Write the report result to the output archive
105-
err := sr.archiveReport(&result)
134+
// Write the unfiltered report result to the output archive
135+
err := sr.archiveReport(&archiveResult)
106136
if err != nil {
107137
log.Error("Failed to archive report: %s", err)
108138
}

0 commit comments

Comments
 (0)