Skip to content

Commit 7aa12eb

Browse files
znullCopilot
andcommitted
Fix lint errors in ioCopier tests
Check error returns from pw.Write, c.Start, c.Wait. Remove redundant embedded field selectors (w.Buffer.String → w.String). Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
1 parent 6e7976a commit 7aa12eb

1 file changed

Lines changed: 11 additions & 11 deletions

File tree

pipe/iocopier_test.go

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -26,13 +26,13 @@ func TestIOCopierPoolBufferUsed(t *testing.T) {
2626
t.Fatal(err)
2727
}
2828
go func() {
29-
pw.Write([]byte(payload))
29+
_, _ = pw.Write([]byte(payload))
3030
pw.Close()
3131
}()
3232
var warmBuf bytes.Buffer
3333
c := newIOCopier(nopWriteCloser{&warmBuf})
34-
c.Start(nil, Env{}, pr)
35-
c.Wait()
34+
_, _ = c.Start(nil, Env{}, pr)
35+
_ = c.Wait()
3636

3737
// Now measure: run the copy and check how many bytes were allocated.
3838
// If the pool buffer is bypassed, a fresh 32KB buffer is allocated.
@@ -41,7 +41,7 @@ func TestIOCopierPoolBufferUsed(t *testing.T) {
4141
t.Fatal(err)
4242
}
4343
go func() {
44-
pw.Write([]byte(payload))
44+
_, _ = pw.Write([]byte(payload))
4545
pw.Close()
4646
}()
4747
var buf bytes.Buffer
@@ -55,8 +55,8 @@ func TestIOCopierPoolBufferUsed(t *testing.T) {
5555
var m1, m2 runtime.MemStats
5656
runtime.ReadMemStats(&m1)
5757

58-
c.Start(nil, Env{}, pr)
59-
c.Wait()
58+
_, _ = c.Start(nil, Env{}, pr)
59+
_ = c.Wait()
6060

6161
runtime.GC()
6262
runtime.ReadMemStats(&m2)
@@ -101,17 +101,17 @@ func TestIOCopierUsesReadFrom(t *testing.T) {
101101
t.Fatal(err)
102102
}
103103
go func() {
104-
pw.Write([]byte(payload))
104+
_, _ = pw.Write([]byte(payload))
105105
pw.Close()
106106
}()
107107

108108
w := &readFromWriter{}
109109
c := newIOCopier(nopWriteCloser{w})
110-
c.Start(nil, Env{}, pr)
111-
c.Wait()
110+
_, _ = c.Start(nil, Env{}, pr)
111+
_ = c.Wait()
112112

113-
if w.Buffer.String() != payload {
114-
t.Fatalf("unexpected output: %q", w.Buffer.String())
113+
if w.String() != payload {
114+
t.Fatalf("unexpected output: %q", w.String())
115115
}
116116

117117
if !w.readFromCalled.Load() {

0 commit comments

Comments
 (0)