From 5108914a6cad76dd1c00d1fbe069f5809677e6a0 Mon Sep 17 00:00:00 2001 From: Eric Paris Date: Wed, 5 Aug 2015 14:07:06 -0400 Subject: Empty slices should be empty, not have a single (empty) string --- string_slice.go | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'string_slice.go') 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 } -- cgit v1.2.3