Skip to content

Commit

Permalink
io: show ErrUnexpectedEOF in ExampleReadAtLeast
Browse files Browse the repository at this point in the history
Fixes #36245

Change-Id: I10ce50b0cc28b15f4e7be85b8f12cf9d0e4fac96
Reviewed-on: https://go-review.googlesource.com/c/go/+/212404
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Emmanuel Odeke <emm.odeke@gmail.com>
  • Loading branch information
ianlancetaylor committed Dec 27, 2019
1 parent 2d6f8cc commit 4f75717
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions src/io/example_test.go
Expand Up @@ -59,7 +59,7 @@ func ExampleCopyN() {
func ExampleReadAtLeast() {
r := strings.NewReader("some io.Reader stream to be read\n")

buf := make([]byte, 33)
buf := make([]byte, 14)
if _, err := io.ReadAtLeast(r, buf, 4); err != nil {
log.Fatal(err)
}
Expand All @@ -78,10 +78,9 @@ func ExampleReadAtLeast() {
}

// Output:
// some io.Reader stream to be read
//
// some io.Reader
// error: short buffer
// error: EOF
// error: unexpected EOF
}

func ExampleReadFull() {
Expand Down

0 comments on commit 4f75717

Please sign in to comment.