Skip to content

Commit 60bd6c3

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 60bd6c3

1 file changed

Lines changed: 12 additions & 11 deletions

File tree

pipe/iocopier_test.go

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ package pipe
22

33
import (
44
"bytes"
5+
"context"
56
"io"
67
"os"
78
"runtime"
@@ -26,13 +27,13 @@ func TestIOCopierPoolBufferUsed(t *testing.T) {
2627
t.Fatal(err)
2728
}
2829
go func() {
29-
pw.Write([]byte(payload))
30+
_, _ = pw.Write([]byte(payload))
3031
pw.Close()
3132
}()
3233
var warmBuf bytes.Buffer
3334
c := newIOCopier(nopWriteCloser{&warmBuf})
34-
c.Start(nil, Env{}, pr)
35-
c.Wait()
35+
_, _ = c.Start(context.TODO(), Env{}, pr)
36+
_ = c.Wait()
3637

3738
// Now measure: run the copy and check how many bytes were allocated.
3839
// If the pool buffer is bypassed, a fresh 32KB buffer is allocated.
@@ -41,7 +42,7 @@ func TestIOCopierPoolBufferUsed(t *testing.T) {
4142
t.Fatal(err)
4243
}
4344
go func() {
44-
pw.Write([]byte(payload))
45+
_, _ = pw.Write([]byte(payload))
4546
pw.Close()
4647
}()
4748
var buf bytes.Buffer
@@ -55,8 +56,8 @@ func TestIOCopierPoolBufferUsed(t *testing.T) {
5556
var m1, m2 runtime.MemStats
5657
runtime.ReadMemStats(&m1)
5758

58-
c.Start(nil, Env{}, pr)
59-
c.Wait()
59+
_, _ = c.Start(context.TODO(), Env{}, pr)
60+
_ = c.Wait()
6061

6162
runtime.GC()
6263
runtime.ReadMemStats(&m2)
@@ -101,17 +102,17 @@ func TestIOCopierUsesReadFrom(t *testing.T) {
101102
t.Fatal(err)
102103
}
103104
go func() {
104-
pw.Write([]byte(payload))
105+
_, _ = pw.Write([]byte(payload))
105106
pw.Close()
106107
}()
107108

108109
w := &readFromWriter{}
109110
c := newIOCopier(nopWriteCloser{w})
110-
c.Start(nil, Env{}, pr)
111-
c.Wait()
111+
_, _ = c.Start(context.TODO(), Env{}, pr)
112+
_ = c.Wait()
112113

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

117118
if !w.readFromCalled.Load() {

0 commit comments

Comments
 (0)