diff options
author | Bjørn Erik Pedersen <[email protected]> | 2021-08-01 12:50:37 +0200 |
---|---|---|
committer | Bjørn Erik Pedersen <[email protected]> | 2021-08-01 13:39:30 +0200 |
commit | 6c70e1f22f365322d5f754302e110c9ed716b215 (patch) | |
tree | bcf30eb942afad09a2a7f56e0d0f490614ec1311 /tpl/inflect | |
parent | 4d221ce468a1209ee9dd6cbece9d1273dad6a29b (diff) | |
download | hugo-6c70e1f22f365322d5f754302e110c9ed716b215.tar.gz hugo-6c70e1f22f365322d5f754302e110c9ed716b215.zip |
Fix error handling for the time func alias
Fixes #8835
Diffstat (limited to 'tpl/inflect')
-rw-r--r-- | tpl/inflect/init.go | 2 | ||||
-rw-r--r-- | tpl/inflect/init_test.go | 4 |
2 files changed, 4 insertions, 2 deletions
diff --git a/tpl/inflect/init.go b/tpl/inflect/init.go index 52b234df3..548827465 100644 --- a/tpl/inflect/init.go +++ b/tpl/inflect/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.Humanize, diff --git a/tpl/inflect/init_test.go b/tpl/inflect/init_test.go index 322813b5f..38499838c 100644 --- a/tpl/inflect/init_test.go +++ b/tpl/inflect/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{}) } |