Skip to content

Commit 6ed951f

Browse files
AlekSipolyfloyd
authored andcommitted
Allow io.ReadFull to return unwrapped io.EOF
It is documented to do so.
1 parent 0716d34 commit 6ed951f

File tree

2 files changed

+4
-0
lines changed

2 files changed

+4
-0
lines changed

errorlint/allowed.go

+1
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ var allowedErrors = []struct {
4040
{err: "io.ErrClosedPipe", fun: "(*io.PipeWriter).Write"},
4141
{err: "io.ErrShortBuffer", fun: "io.ReadAtLeast"},
4242
{err: "io.ErrUnexpectedEOF", fun: "io.ReadAtLeast"},
43+
{err: "io.EOF", fun: "io.ReadFull"},
4344
{err: "io.ErrUnexpectedEOF", fun: "io.ReadFull"},
4445
// pkg/net/http
4546
{err: "http.ErrServerClosed", fun: "(*net/http.Server).ListenAndServe"},

errorlint/testdata/src/allowed/allowed.go

+3
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,9 @@ func IoReadAtLeast(r io.Reader) {
102102
func IoReadFull(r io.Reader) {
103103
var buf [4096]byte
104104
_, err := io.ReadFull(r, buf[:])
105+
if err == io.EOF {
106+
fmt.Println(err)
107+
}
105108
if err == io.ErrUnexpectedEOF {
106109
fmt.Println(err)
107110
}

0 commit comments

Comments
 (0)