diff options
author | Jess Frazelle <me@jessfraz.com> | 2016-05-20 14:35:28 -0700 |
---|---|---|
committer | Ian Lance Taylor <iant@golang.org> | 2016-06-10 01:00:09 +0000 |
commit | 8042bfe347d5b2c4f6af372b09b23c8945fb196e (patch) | |
tree | d0c6d0cd29b8d1d5b59f4959e133e2c976ac6f28 | |
parent | cbc26869b7835e45359dad7dfb70e85c02c820cd (diff) | |
download | go-8042bfe347d5b2c4f6af372b09b23c8945fb196e.tar.gz go-8042bfe347d5b2c4f6af372b09b23c8945fb196e.zip |
encoding/csv: update doc about comments whitespace
This patch updates the doc about comments whitespace for the
encoding/csv package to reflect that leading whitespace before
the hash will treat the line as not a comment.
Fixes #13775.
Change-Id: Ia468c75b242a487b4b2b4cd3d342bfb8e07720ba
Reviewed-on: https://go-review.googlesource.com/23302
Reviewed-by: Ian Lance Taylor <iant@golang.org>
-rw-r--r-- | src/encoding/csv/reader.go | 53 |
1 files changed, 27 insertions, 26 deletions
diff --git a/src/encoding/csv/reader.go b/src/encoding/csv/reader.go index 89283bb303..a5e03a9f8e 100644 --- a/src/encoding/csv/reader.go +++ b/src/encoding/csv/reader.go @@ -86,34 +86,35 @@ var ( // The exported fields can be changed to customize the details before the // first call to Read or ReadAll. // -// Comma is the field delimiter. It defaults to ','. // -// Comment, if not 0, is the comment character. Lines beginning with the -// Comment character are ignored. -// -// If FieldsPerRecord is positive, Read requires each record to -// have the given number of fields. If FieldsPerRecord is 0, Read sets it to -// the number of fields in the first record, so that future records must -// have the same field count. If FieldsPerRecord is negative, no check is -// made and records may have a variable number of fields. -// -// If LazyQuotes is true, a quote may appear in an unquoted field and a -// non-doubled quote may appear in a quoted field. -// -// If TrimLeadingSpace is true, leading white space in a field is ignored. -// If the field delimiter is white space, TrimLeadingSpace will trim the -// delimiter. type Reader struct { - Comma rune // field delimiter (set to ',' by NewReader) - Comment rune // comment character for start of line - FieldsPerRecord int // number of expected fields per record - LazyQuotes bool // allow lazy quotes - TrailingComma bool // ignored; here for backwards compatibility - TrimLeadingSpace bool // trim leading space - line int - column int - r *bufio.Reader - field bytes.Buffer + // Comma is the field delimiter. + // It is set to comma (',') by NewReader. + Comma rune + // Comment, if not 0, is the comment character. Lines beginning with the + // Comment character without preceding whitespace are ignored. + // With leading whitespace the Comment character becomes part of the + // field, even if TrimLeadingSpace is true. + Comment rune + // FieldsPerRecord is the number of expected fields per record. + // If FieldsPerRecord is positive, Read requires each record to + // have the given number of fields. If FieldsPerRecord is 0, Read sets it to + // the number of fields in the first record, so that future records must + // have the same field count. If FieldsPerRecord is negative, no check is + // made and records may have a variable number of fields. + FieldsPerRecord int + // If LazyQuotes is true, a quote may appear in an unquoted field and a + // non-doubled quote may appear in a quoted field. + LazyQuotes bool + TrailingComma bool // ignored; here for backwards compatibility + // If TrimLeadingSpace is true, leading white space in a field is ignored. + // This is done even if the field delimiter, Comma, is white space. + TrimLeadingSpace bool + + line int + column int + r *bufio.Reader + field bytes.Buffer } // NewReader returns a new Reader that reads from r. |