diff options
author | Bjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com> | 2017-05-20 11:28:33 +0300 |
---|---|---|
committer | Bjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com> | 2017-05-20 11:34:38 +0300 |
commit | 1f9e8dcc6010abeea8abc7ba1a092c4dab9852f6 (patch) | |
tree | 96f71adc6ae9a109817a30055476d1409d55b60b /tpl/internal | |
parent | ebd636e4d5f475d4b5d9047580e61ff7c2bf2fb5 (diff) |
tpl: Make the Namespace func signature explicit
This makes it cleaner and avoids breaking client code, such as the docs helper JSON generator.
Diffstat (limited to 'tpl/internal')
-rw-r--r-- | tpl/internal/templatefuncsRegistry.go | 4 |
1 files changed, 2 insertions, 2 deletions
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) |