summaryrefslogtreecommitdiffstats
path: root/tpl/time
diff options
context:
space:
mode:
authorBjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com>2017-05-20 11:28:33 +0300
committerBjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com>2017-05-20 11:34:38 +0300
commit1f9e8dcc6010abeea8abc7ba1a092c4dab9852f6 (patch)
tree96f71adc6ae9a109817a30055476d1409d55b60b /tpl/time
parentebd636e4d5f475d4b5d9047580e61ff7c2bf2fb5 (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/time')
-rw-r--r--tpl/time/init.go6
-rw-r--r--tpl/time/init_test.go2
2 files changed, 4 insertions, 4 deletions
diff --git a/tpl/time/init.go b/tpl/time/init.go
index 8e21bca61..760986e5a 100644
--- a/tpl/time/init.go
+++ b/tpl/time/init.go
@@ -26,7 +26,7 @@ func init() {
ns := &internal.TemplateFuncsNamespace{
Name: name,
- Context: func(v ...interface{}) interface{} {
+ Context: func(args ...interface{}) interface{} {
// Handle overlapping "time" namespace and func.
//
// If no args are passed to `time`, assume namespace usage and
@@ -34,11 +34,11 @@ func init() {
//
// If args are passed, call AsTime().
- if len(v) == 0 {
+ if len(args) == 0 {
return ctx
}
- t, err := ctx.AsTime(v[0])
+ t, err := ctx.AsTime(args[0])
if err != nil {
return err
}
diff --git a/tpl/time/init_test.go b/tpl/time/init_test.go
index fd49dc4be..4f4ee5de5 100644
--- a/tpl/time/init_test.go
+++ b/tpl/time/init_test.go
@@ -34,5 +34,5 @@ func TestInit(t *testing.T) {
}
require.True(t, found)
- require.IsType(t, &Namespace{}, ns.Context.(func(v ...interface{}) interface{})())
+ require.IsType(t, &Namespace{}, ns.Context())
}