12 years, 2 months ago
(2012-02-08 00:33:37 UTC)
#3
LGTM
r@golang.org writes:
> Reviewers: golang-dev_googlegroups.com,
>
> Message:
> Hello golang-dev@googlegroups.com,
>
> I'd like you to review this change to
> https://go.googlecode.com/hg/
>
>
> Description:
> io/ioutil: document EOF behavior in ReadFile and ReadAll
>
> Fixes issue 2862.
>
> Please review this at http://codereview.appspot.com/5646048/
>
> Affected files:
> M src/pkg/io/ioutil/ioutil.go
>
>
> Index: src/pkg/io/ioutil/ioutil.go
> ===================================================================
> --- a/src/pkg/io/ioutil/ioutil.go
> +++ b/src/pkg/io/ioutil/ioutil.go
> @@ -34,11 +34,17 @@
> }
>
> // ReadAll reads from r until an error or EOF and returns the data it read.
> +// A successful call returns err == nil, not err == EOF. Because ReadAll is
> +// defined to read from src until EOF, it does not treat an EOF from Read
> +// as an error to be reported.
> func ReadAll(r io.Reader) ([]byte, error) {
> return readAll(r, bytes.MinRead)
> }
>
> // ReadFile reads the file named by filename and returns the contents.
> +// A successful call returns err == nil, not err == EOF. Because ReadFile
> +// reads the whole file, it does not treat an EOF from Read as an error
> +// to be reported.
> func ReadFile(filename string) ([]byte, error) {
> f, err := os.Open(filename)
> if err != nil {
Issue 5646048: code review 5646048: io/ioutil: document EOF behavior in ReadFile and ReadAll
(Closed)
Created 12 years, 2 months ago by r
Modified 12 years, 2 months ago
Reviewers:
Base URL:
Comments: 0