From 1f9e8dcc6010abeea8abc7ba1a092c4dab9852f6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B8rn=20Erik=20Pedersen?= Date: Sat, 20 May 2017 11:28:33 +0300 Subject: tpl: Make the Namespace func signature explicit This makes it cleaner and avoids breaking client code, such as the docs helper JSON generator. --- tpl/internal/templatefuncsRegistry.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'tpl/internal') diff --git a/tpl/internal/templatefuncsRegistry.go b/tpl/internal/templatefuncsRegistry.go index ced16e512..1ecdeca94 100644 --- a/tpl/internal/templatefuncsRegistry.go +++ b/tpl/internal/templatefuncsRegistry.go @@ -45,7 +45,7 @@ type TemplateFuncsNamespace struct { Name string // This is the method receiver. - Context interface{} + Context func(v ...interface{}) interface{} // Additional info, aliases and examples, per method name. MethodMappings map[string]TemplateFuncMethodMapping @@ -165,7 +165,7 @@ func (t *TemplateFuncsNamespace) toJSON() ([]byte, error) { buf.WriteString(fmt.Sprintf(`%q: {`, t.Name)) - ctx := t.Context.(func() interface{})() + ctx := t.Context() ctxType := reflect.TypeOf(ctx) for i := 0; i < ctxType.NumMethod(); i++ { method := ctxType.Method(i) -- cgit v1.2.3