From 230d16dd9327baae41547555a9083ec7f4bdfdd7 Mon Sep 17 00:00:00 2001 From: Cameron Moore Date: Fri, 20 Mar 2015 16:54:03 -0500 Subject: [PATCH] Only support unsigned ints for slice indexes This commit changes ExtractParameter to parse slice indexes as unsigned ints. Fixes test case "a.-1.b". --- hook/hook.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hook/hook.go b/hook/hook.go index 669c177..cc83e72 100644 --- a/hook/hook.go +++ b/hook/hook.go @@ -44,7 +44,7 @@ func ExtractParameter(s string, params interface{}) (string, bool) { if paramsValueSliceLength := paramsValue.Len(); paramsValueSliceLength > 0 { if p := strings.SplitN(s, ".", 2); len(p) > 1 { - index, err := strconv.ParseInt(p[0], 10, 64) + index, err := strconv.ParseUint(p[0], 10, 64) if err != nil { return "", false