From f8a53df314e4af8cd350eedb0dae77d4c4fc30d0 Mon Sep 17 00:00:00 2001 From: Russ Cox Date: Fri, 3 Jun 2022 16:00:16 -0400 Subject: io: revert: add an Err field to LimitedReader We are having a hard time deciding the exact semantics of the Err field, and we need to ship the beta. So revert the Err field change; it can wait for Go 1.20. For #51115. This reverts CL 396215. Change-Id: I7719386567d3da10a614058a11f19dbccf304b4d Reviewed-on: https://go-review.googlesource.com/c/go/+/410133 TryBot-Result: Gopher Robot Reviewed-by: Ian Lance Taylor Reviewed-by: Dmitri Shuralyov Reviewed-by: Dmitri Shuralyov Run-TryBot: Russ Cox Reviewed-by: Bryan Mills Auto-Submit: Russ Cox --- src/io/example_test.go | 14 -------------- 1 file changed, 14 deletions(-) (limited to 'src/io/example_test.go') diff --git a/src/io/example_test.go b/src/io/example_test.go index e4b20bd981..419e449982 100644 --- a/src/io/example_test.go +++ b/src/io/example_test.go @@ -6,7 +6,6 @@ package io_test import ( "bytes" - "errors" "fmt" "io" "log" @@ -284,16 +283,3 @@ func ExampleReadAll() { // Output: // Go is a general-purpose language designed with systems programming in mind. } - -func ExampleLimitedReader() { - r := strings.NewReader("some io.Reader stream to be read\n") - sentinel := errors.New("reached read limit") - lr := &io.LimitedReader{R: r, N: 4, Err: sentinel} - - if _, err := io.Copy(os.Stdout, lr); err != sentinel { - log.Fatal(err) - } - - // Output: - // some -} -- cgit v1.3-5-g9baa