From 607a04588886b3d605500942f20de9dbab02ed9d Mon Sep 17 00:00:00 2001 From: IvoGoman Date: Tue, 9 May 2023 20:46:23 +0000 Subject: [PATCH] encoding/csv: update doc comment of Read method This updates the doc comment to reflect the behavior of the method. On error the method returns a partial result. Fixes #59991 Change-Id: I71e9dfa37e0488c85abd3eeede2a1a34cb74239b GitHub-Last-Rev: 389488e5364dc939f0cbd11f99eb56001b5237a2 GitHub-Pull-Request: golang/go#60084 Reviewed-on: https://go-review.googlesource.com/c/go/+/494055 Reviewed-by: Ian Lance Taylor Reviewed-by: Benny Siegert TryBot-Result: Gopher Robot Auto-Submit: Ian Lance Taylor Run-TryBot: Ian Lance Taylor --- src/encoding/csv/reader.go | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/encoding/csv/reader.go b/src/encoding/csv/reader.go index b83208eb3a..c6a8ed02c1 100644 --- a/src/encoding/csv/reader.go +++ b/src/encoding/csv/reader.go @@ -187,8 +187,9 @@ func NewReader(r io.Reader) *Reader { // Read reads one record (a slice of fields) from r. // 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 the record contains a field that cannot be parsed, +// Read returns a partial record along with the parse error. +// The partial record contains all fields read before the error. // If there is no data left to be read, Read returns nil, io.EOF. // If ReuseRecord is true, the returned slice may be shared // between multiple calls to Read. -- 2.50.0