From 4e0cf6011e0da8bbaa9b9b63ea347e4dc59b9ca3 Mon Sep 17 00:00:00 2001 From: Petter Rasmussen Date: Sat, 23 Jan 2016 10:57:13 +0100 Subject: Prevent mutation of input values --- cli/parser.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'cli') diff --git a/cli/parser.go b/cli/parser.go index 50bd0bd..5fbbe3f 100644 --- a/cli/parser.go +++ b/cli/parser.go @@ -330,7 +330,7 @@ func flagKeyValueMatch(key string, values []string, index int) ([]string, string if values[index] == key { value := values[index + 1] - remaining := append(values[:index], values[index + 2:]...) + remaining := append(copySlice(values[:index]), values[index + 2:]...) return remaining, value, true } @@ -343,7 +343,7 @@ func flagKeyMatch(key string, values []string, index int) ([]string, bool) { } if values[index] == key { - remaining := append(values[:index], values[index + 1:]...) + remaining := append(copySlice(values[:index]), values[index + 1:]...) return remaining, true } -- cgit v1.2.3