1
0
mirror of https://github.com/golang/go synced 2024-11-18 01:14:48 -07:00

encoding/csv: document Read error behavior

Fixes #17342.

Change-Id: I76af756d7aff464554c5564d444962a468d0eccc
Reviewed-on: https://go-review.googlesource.com/32172
Run-TryBot: Russ Cox <rsc@golang.org>
Reviewed-by: Quentin Smith <quentin@golang.org>
This commit is contained in:
Russ Cox 2016-10-26 12:22:16 -04:00
parent e2bcae7875
commit 30651b3bbb

View File

@ -141,8 +141,12 @@ func (r *Reader) error(err error) error {
} }
} }
// Read reads one record from r. The record is a slice of strings with each // Read reads one record (a slice of fields) from r.
// string representing one field. // If the record has an unexpected number of fields,
// Read returns the record along with the error ErrFieldCount.
// Except for that case, Read always returns either a non-nil
// record or a non-nil error, but not both.
// If there is no data left to be read, Read returns nil, io.EOF.
func (r *Reader) Read() (record []string, err error) { func (r *Reader) Read() (record []string, err error) {
for { for {
record, err = r.parseRecord() record, err = r.parseRecord()