Discard the error of Pipeline.Wait explicitly in a test

TestClosingAPipelinesOutputBringsItDown receives the error of
Pipeline.Wait from a channel and ignores it. errcheck v1.30.0 reports
such a receive as an unchecked error. golangci-lint 2.15.0 comes with
this errcheck version, and the next commit bumps to it.

The test ignores the error on purpose. It only checks that Wait returns,
and the error depends on the platform. Make that explicit by discarding
the error in the goroutine, and use the channel only to signal that
Wait has returned.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This commit is contained in:
Stefan Haller
2026-10-17 12:14:56 +02:00
co-authored by Claude Opus 5.5
parent 4b38f6f8b7
commit 0a11e1289a
+8 -2
View File
@@ -112,8 +112,14 @@ func TestClosingAPipelinesOutputBringsItDown(t *testing.T) {
assert.NoError(t, reader.Close())
done := make(chan error, 1)
go func() { done <- pipeline.Wait() }()
// Only whether Wait returns matters here, not its error. If a write into a
// closed pipe raises a signal, the last command dies of it and Wait reports
// that; otherwise the command exits normally.
done := make(chan struct{})
go func() {
_ = pipeline.Wait()
close(done)
}()
select {
case <-done: