Skip to content

Commit 0ca9de0

Browse files
authored
Merge pull request #209 from gitpod-io/aledbf/package-build
Fix display of build errors
2 parents bdc2946 + 10419ff commit 0ca9de0

File tree

1 file changed

+8
-6
lines changed

1 file changed

+8
-6
lines changed

pkg/leeway/reporter.go

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -215,13 +215,15 @@ func (r *ConsoleReporter) PackageBuildFinished(pkg *Package, rep *PackageBuildRe
215215
delete(r.times, nme)
216216
r.mu.Unlock()
217217

218-
var coverage string
219-
if rep.TestCoverageAvailable {
220-
coverage = color.Sprintf("<fg=yellow>test coverage: %d%%</> <gray>(%d of %d functions have tests)</>\n", rep.TestCoveragePercentage, rep.FunctionsWithTest, rep.FunctionsWithTest+rep.FunctionsWithoutTest)
221-
}
222-
msg := color.Sprintf("%s<green>package build succeded</> <gray>(%.2fs)</>\n", coverage, dur.Seconds())
218+
var msg string
223219
if rep.Error != nil {
224220
msg = color.Sprintf("<red>package build failed while %sing</>\n<white>Reason:</> %s\n", rep.LastPhase(), rep.Error)
221+
} else {
222+
var coverage string
223+
if rep.TestCoverageAvailable {
224+
coverage = color.Sprintf("<fg=yellow>test coverage: %d%%</> <gray>(%d of %d functions have tests)</>\n", rep.TestCoveragePercentage, rep.FunctionsWithTest, rep.FunctionsWithTest+rep.FunctionsWithoutTest)
225+
}
226+
msg = color.Sprintf("%s<green>package build succeded</> <gray>(%.2fs)</>\n", coverage, dur.Seconds())
225227
}
226228
//nolint:errcheck
227229
io.WriteString(out, msg)
@@ -438,7 +440,7 @@ func (r *HTMLReporter) Report() {
438440
{{- range $pkg, $report := .Packages }}
439441
<h2 id="{{ $report.ID }}">{{ $report.StatusIcon }} {{ $pkg }}</h2>
440442
{{ if $report.HasError -}}
441-
<details open>
443+
<details open>
442444
<summary>Error message</summary>
443445
<pre><code>{{ $report.Error }}</code></pre>
444446
</details>

0 commit comments

Comments
 (0)