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/crypto/init.go | 2 +- tpl/crypto/init_test.go | 4 +++- 2 files changed, 4 insertions(+), 2 deletions(-) (limited to 'tpl/crypto') diff --git a/tpl/crypto/init.go b/tpl/crypto/init.go index 2c6e94298..5ce2a4b5e 100644 --- a/tpl/crypto/init.go +++ b/tpl/crypto/init.go @@ -26,7 +26,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.MD5, diff --git a/tpl/crypto/init_test.go b/tpl/crypto/init_test.go index 120e1e4e7..1c200d777 100644 --- a/tpl/crypto/init_test.go +++ b/tpl/crypto/init_test.go @@ -36,5 +36,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