diff options
| author | Eric Paris <[email protected]> | 2015-08-05 12:00:39 -0500 |
|---|---|---|
| committer | Eric Paris <[email protected]> | 2015-08-05 12:00:39 -0500 |
| commit | 08f04032975dbfebf7a5946d581eae0724af18f4 (patch) | |
| tree | 6655dd93a25fe82dfe6362ba8c87f874158834f4 /int_slice.go | |
| parent | af83f852cb3533df209ffef0b0f36b65d4594848 (diff) | |
| parent | 90b831e61ee0ea159e0d00bb0c1ee3cd0c1dcdcd (diff) | |
Merge pull request #35 from eparis/slice-multi-call
String and Int slices called twice should append not overwrite
Diffstat (limited to 'int_slice.go')
| -rw-r--r-- | int_slice.go | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/int_slice.go b/int_slice.go index fb3e67b..69e7e7c 100644 --- a/int_slice.go +++ b/int_slice.go @@ -25,7 +25,7 @@ func (s *intSliceValue) Set(val string) error { } } - *s = intSliceValue(out) + *s = append(*s, out...) return nil } @@ -38,10 +38,11 @@ func (s *intSliceValue) String() string { for i, d := range *s { out[i] = fmt.Sprintf("%d", d) } - return strings.Join(out, ",") + return "[" + strings.Join(out, ",") + "]" } func intSliceConv(val string) (interface{}, error) { + val = strings.Trim(val, "[]") ss := strings.Split(val, ",") out := make([]int, len(ss)) for i, d := range ss { |
