aboutsummaryrefslogtreecommitdiff
path: root/string_slice.go
diff options
context:
space:
mode:
Diffstat (limited to 'string_slice.go')
-rw-r--r--string_slice.go11
1 files changed, 9 insertions, 2 deletions
diff --git a/string_slice.go b/string_slice.go
index b53648b..f2a49d9 100644
--- a/string_slice.go
+++ b/string_slice.go
@@ -21,10 +21,17 @@ func newStringSliceValue(val []string, p *[]string) *stringSliceValue {
return ssv
}
-func (s *stringSliceValue) Set(val string) error {
+func readAsCSV(val string) ([]string, error) {
+ if val == "" {
+ return []string{}, nil
+ }
stringReader := strings.NewReader(val)
csvReader := csv.NewReader(stringReader)
- v, err := csvReader.Read()
+ return csvReader.Read()
+}
+
+func (s *stringSliceValue) Set(val string) error {
+ v, err := readAsCSV(val)
if err != nil {
return err
}