diff options
author | Bjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com> | 2018-12-23 23:08:12 +0300 |
---|---|---|
committer | Bjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com> | 2018-12-23 23:09:09 +0300 |
commit | ce06bdb16a64dd39a8ebbb2e5a53b33520b00bb1 (patch) | |
tree | 6dac463a32206d7f13f812d384d48334cf936f70 /tpl/transform | |
parent | 2efc1a64c391420b1007f6e94b6ff616fb136635 (diff) |
Rename CSV option from comma to delimiter
See #5555
Diffstat (limited to 'tpl/transform')
-rw-r--r-- | tpl/transform/unmarshal.go | 4 | ||||
-rw-r--r-- | tpl/transform/unmarshal_test.go | 6 |
2 files changed, 5 insertions, 5 deletions
diff --git a/tpl/transform/unmarshal.go b/tpl/transform/unmarshal.go index e0574eb04..bc8386975 100644 --- a/tpl/transform/unmarshal.go +++ b/tpl/transform/unmarshal.go @@ -116,12 +116,12 @@ func decodeDecoder(m map[string]interface{}) (metadecoders.Decoder, error) { // mapstructure does not support string to rune conversion, so do that manually. // See https://github.com/mitchellh/mapstructure/issues/151 for k, v := range m { - if strings.EqualFold(k, "Comma") { + if strings.EqualFold(k, "Delimiter") { r, err := stringToRune(v) if err != nil { return opts, err } - opts.Comma = r + opts.Delimiter = r delete(m, k) } else if strings.EqualFold(k, "Comment") { diff --git a/tpl/transform/unmarshal_test.go b/tpl/transform/unmarshal_test.go index b1ce30b1f..d9ebd1f89 100644 --- a/tpl/transform/unmarshal_test.go +++ b/tpl/transform/unmarshal_test.go @@ -118,7 +118,7 @@ func TestUnmarshal(t *testing.T) { assert.Equal(5, len(first)) assert.Equal("Ford", first[1]) }}, - {testContentResource{key: "r1", content: `a;b;c`, mime: media.CSVType}, map[string]interface{}{"comma": ";"}, func(r [][]string) { + {testContentResource{key: "r1", content: `a;b;c`, mime: media.CSVType}, map[string]interface{}{"delimiter": ";"}, func(r [][]string) { assert.Equal(r, [][]string{[]string{"a", "b", "c"}}) }}, @@ -126,13 +126,13 @@ func TestUnmarshal(t *testing.T) { assert.Equal(r, [][]string{[]string{"a", "b", "c"}}) }}, - {"a;b;c", map[string]interface{}{"comma": ";"}, func(r [][]string) { + {"a;b;c", map[string]interface{}{"delimiter": ";"}, func(r [][]string) { assert.Equal(r, [][]string{[]string{"a", "b", "c"}}) }}, {testContentResource{key: "r1", content: ` % This is a comment -a;b;c`, mime: media.CSVType}, map[string]interface{}{"CommA": ";", "Comment": "%"}, func(r [][]string) { +a;b;c`, mime: media.CSVType}, map[string]interface{}{"DElimiter": ";", "Comment": "%"}, func(r [][]string) { assert.Equal(r, [][]string{[]string{"a", "b", "c"}}) }}, |