io: add error check to TeeReader Example

Change-Id: I0b94bdced47483c6412e9979ce2d103fbfc52afb
Reviewed-on: https://go-review.googlesource.com/c/go/+/353729
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Trust: Carlos Amedee <carlos@golang.org>
This commit is contained in:
jiahua wang 2021-10-02 22:50:31 +08:00 committed by Ian Lance Taylor
parent 84277bfd07
commit 8ce1a953fb
1 changed files with 3 additions and 1 deletions

View File

@ -142,7 +142,9 @@ func ExampleTeeReader() {
r = io.TeeReader(r, os.Stdout)
// Everything read from r will be copied to stdout.
io.ReadAll(r)
if _, err := io.ReadAll(r); err != nil {
log.Fatal(err)
}
// Output:
// some io.Reader stream to be read