From 7f8530039aa018f23bad9d58e97777705a6d19ac Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B8rn=20Erik=20Pedersen?= Date: Tue, 23 Feb 2021 09:36:11 +0100 Subject: [PATCH] tpl: Add method mappings for strings.Contains, strings.ContainsAny Just to confirm/document the function signature. --- tpl/strings/init.go | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/tpl/strings/init.go b/tpl/strings/init.go index 26d63519a..dab4fdbaa 100644 --- a/tpl/strings/init.go +++ b/tpl/strings/init.go @@ -58,6 +58,22 @@ func init() { }, ) + ns.AddMethodMapping(ctx.Contains, + nil, + [][2]string{ + {`{{ strings.Contains "abc" "b" }}`, `true`}, + {`{{ strings.Contains "abc" "d" }}`, `false`}, + }, + ) + + ns.AddMethodMapping(ctx.ContainsAny, + nil, + [][2]string{ + {`{{ strings.ContainsAny "abc" "bcd" }}`, `true`}, + {`{{ strings.ContainsAny "abc" "def" }}`, `false`}, + }, + ) + ns.AddMethodMapping(ctx.FindRE, []string{"findRE"}, [][2]string{