diff options
| author | Eric Paris <[email protected]> | 2015-08-05 14:07:06 -0400 |
|---|---|---|
| committer | Eric Paris <[email protected]> | 2015-08-05 14:07:06 -0400 |
| commit | 5108914a6cad76dd1c00d1fbe069f5809677e6a0 (patch) | |
| tree | 6cf0e5e12144fde8eb6a1a847863b4d0b0b3ef24 /string_slice.go | |
| parent | 08f04032975dbfebf7a5946d581eae0724af18f4 (diff) | |
Empty slices should be empty, not have a single (empty) string
Diffstat (limited to 'string_slice.go')
| -rw-r--r-- | string_slice.go | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/string_slice.go b/string_slice.go index 20d94ba..2037bd8 100644 --- a/string_slice.go +++ b/string_slice.go @@ -25,6 +25,10 @@ func (s *stringSliceValue) String() string { return "[" + strings.Join(*s, ",") func stringSliceConv(sval string) (interface{}, error) { sval = strings.Trim(sval, "[]") + // An empty string would cause a slice with one (empty) string + if len(sval) == 0 { + return []string{}, nil + } v := strings.Split(sval, ",") return v, nil } |
