From 15ac366c8d28d438ef49ca711104db1dc836b7d5 Mon Sep 17 00:00:00 2001 From: Thomas KERAMBLOCH Date: Mon, 12 Feb 2018 16:36:21 +0100 Subject: [PATCH] fix type int32 in index helper --- helpers/helpers.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/helpers/helpers.go b/helpers/helpers.go index c7ee41d..2484e56 100644 --- a/helpers/helpers.go +++ b/helpers/helpers.go @@ -91,15 +91,15 @@ var ProtoHelpersFuncMap = template.FuncMap{ "trimstr": func(cutset, s string) string { return strings.Trim(s, cutset) }, - "index": func(array interface{}, i int) interface{} { + "index": func(array interface{}, i int32) interface{} { slice := reflect.ValueOf(array) if slice.Kind() != reflect.Slice { panic("Error in index(): given a non-slice type") } - if i < 0 || i >= slice.Len() { + if i < 0 || int(i) >= slice.Len() { panic("Error in index(): index out of bounds") } - return slice.Index(i).Interface() + return slice.Index(int(i)).Interface() }, "snakeCase": xstrings.ToSnakeCase, "getProtoFile": getProtoFile,