Rename CSV option from comma to delimiter

See #5555
This commit is contained in:
Bjørn Erik Pedersen 2018-12-23 21:08:12 +01:00
parent 2efc1a64c3
commit ce06bdb16a
No known key found for this signature in database
GPG key ID: 330E6E2BD4859D8F
6 changed files with 14 additions and 15 deletions

View file

@ -31,8 +31,8 @@ import (
// Decoder provides some configuration options for the decoders.
type Decoder struct {
// Comma is the field delimiter used in the CSV decoder. It defaults to ','.
Comma rune
// Delimiter is the field delimiter used in the CSV decoder. It defaults to ','.
Delimiter rune
// Comment, if not 0, is the comment character ued in the CSV decoder. Lines beginning with the
// Comment character without preceding whitespace are ignored.
@ -41,7 +41,7 @@ type Decoder struct {
// Default is a Decoder in its default configuration.
var Default = Decoder{
Comma: ',',
Delimiter: ',',
}
// UnmarshalToMap will unmarshall data in format f into a new map. This is
@ -156,7 +156,7 @@ func (d Decoder) unmarshal(data []byte, f Format, v interface{}) error {
func (d Decoder) unmarshalCSV(data []byte, v interface{}) error {
r := csv.NewReader(bytes.NewReader(data))
r.Comma = d.Comma
r.Comma = d.Delimiter
r.Comment = d.Comment
records, err := r.ReadAll()