From 80a62f29d86d3669adb4ba3d7385ffb8291f786f Mon Sep 17 00:00:00 2001 From: Pierre Roullon Date: Thu, 22 Jun 2017 13:35:19 +0200 Subject: [PATCH] fix (helper): splitArray helper does not return emtpy string --- helpers/helpers.go | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/helpers/helpers.go b/helpers/helpers.go index bb3437d..161fdba 100644 --- a/helpers/helpers.go +++ b/helpers/helpers.go @@ -40,7 +40,14 @@ var ProtoHelpersFuncMap = template.FuncMap{ return string(a) }, "splitArray": func(sep string, s string) []string { - return strings.Split(s, sep) + var r []string + t := strings.Split(s, sep) + for i := range t { + if t[i] != "" { + r = append(r, t[i]) + } + } + return r }, "first": func(a []string) string { return a[0]