From 6c70e1f22f365322d5f754302e110c9ed716b215 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B8rn=20Erik=20Pedersen?= Date: Sun, 1 Aug 2021 12:50:37 +0200 Subject: Fix error handling for the time func alias Fixes #8835 --- tpl/reflect/init.go | 2 +- tpl/reflect/init_test.go | 4 +++- 2 files changed, 4 insertions(+), 2 deletions(-) (limited to 'tpl/reflect') diff --git a/tpl/reflect/init.go b/tpl/reflect/init.go index 6ff3f8093..63500a6a4 100644 --- a/tpl/reflect/init.go +++ b/tpl/reflect/init.go @@ -27,7 +27,7 @@ func init() { ns := &internal.TemplateFuncsNamespace{ Name: name, - Context: func(args ...interface{}) interface{} { return ctx }, + Context: func(args ...interface{}) (interface{}, error) { return ctx, nil }, } ns.AddMethodMapping(ctx.IsMap, diff --git a/tpl/reflect/init_test.go b/tpl/reflect/init_test.go index c0247b045..2ad33fc25 100644 --- a/tpl/reflect/init_test.go +++ b/tpl/reflect/init_test.go @@ -37,5 +37,7 @@ func TestInit(t *testing.T) { } c.Assert(found, qt.Equals, true) - c.Assert(ns.Context(), hqt.IsSameType, &Namespace{}) + ctx, err := ns.Context() + c.Assert(err, qt.IsNil) + c.Assert(ctx, hqt.IsSameType, &Namespace{}) } -- cgit v1.2.3