aboutsummaryrefslogtreecommitdiff
path: root/int_slice.go
diff options
context:
space:
mode:
authorEric Paris <[email protected]>2015-08-05 14:07:06 -0400
committerEric Paris <[email protected]>2015-08-05 14:07:06 -0400
commit5108914a6cad76dd1c00d1fbe069f5809677e6a0 (patch)
tree6cf0e5e12144fde8eb6a1a847863b4d0b0b3ef24 /int_slice.go
parent08f04032975dbfebf7a5946d581eae0724af18f4 (diff)
Empty slices should be empty, not have a single (empty) string
Diffstat (limited to 'int_slice.go')
-rw-r--r--int_slice.go4
1 files changed, 4 insertions, 0 deletions
diff --git a/int_slice.go b/int_slice.go
index 69e7e7c..b28353d 100644
--- a/int_slice.go
+++ b/int_slice.go
@@ -43,6 +43,10 @@ func (s *intSliceValue) String() string {
func intSliceConv(val string) (interface{}, error) {
val = strings.Trim(val, "[]")
+ // Empty string would cause a slice with one (empty) entry
+ if len(val) == 0 {
+ return []int{}, nil
+ }
ss := strings.Split(val, ",")
out := make([]int, len(ss))
for i, d := range ss {