summaryrefslogtreecommitdiffstats
path: root/tpl/tplimpl
diff options
context:
space:
mode:
authorBjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com>2022-03-17 22:03:27 +0100
committerBjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com>2022-03-17 22:03:27 +0100
commitb80853de90b10171155b8f3fde47d64ec7bfa0dd (patch)
tree435d3dbf7a495a0c6ce64c9769e037179aa0d27b /tpl/tplimpl
parent423594e03a906ef4150f433666ff588b022c3c92 (diff)
all: gofmt -w -r 'interface{} -> any' .
Updates #9687
Diffstat (limited to 'tpl/tplimpl')
-rw-r--r--tpl/tplimpl/template.go10
-rw-r--r--tpl/tplimpl/template_ast_transformers_test.go4
-rw-r--r--tpl/tplimpl/template_funcs.go2
3 files changed, 8 insertions, 8 deletions
diff --git a/tpl/tplimpl/template.go b/tpl/tplimpl/template.go
index 706719278..4cee19a20 100644
--- a/tpl/tplimpl/template.go
+++ b/tpl/tplimpl/template.go
@@ -118,7 +118,7 @@ func newIdentity(name string) identity.Manager {
return identity.NewManager(identity.NewPathIdentity(files.ComponentFolderLayouts, name))
}
-func newStandaloneTextTemplate(funcs map[string]interface{}) tpl.TemplateParseFinder {
+func newStandaloneTextTemplate(funcs map[string]any) tpl.TemplateParseFinder {
return &textTemplateWrapperWithLock{
RWMutex: &sync.RWMutex{},
Template: texttemplate.New("").Funcs(funcs),
@@ -127,7 +127,7 @@ func newStandaloneTextTemplate(funcs map[string]interface{}) tpl.TemplateParseFi
func newTemplateExec(d *deps.Deps) (*templateExec, error) {
exec, funcs := newTemplateExecuter(d)
- funcMap := make(map[string]interface{})
+ funcMap := make(map[string]any)
for k, v := range funcs {
funcMap[k] = v.Interface()
}
@@ -184,7 +184,7 @@ func newTemplateExec(d *deps.Deps) (*templateExec, error) {
return e, nil
}
-func newTemplateNamespace(funcs map[string]interface{}) *templateNamespace {
+func newTemplateNamespace(funcs map[string]any) *templateNamespace {
return &templateNamespace{
prototypeHTML: htmltemplate.New("").Funcs(funcs),
prototypeText: texttemplate.New("").Funcs(funcs),
@@ -225,11 +225,11 @@ func (t templateExec) Clone(d *deps.Deps) *templateExec {
return &t
}
-func (t *templateExec) Execute(templ tpl.Template, wr io.Writer, data interface{}) error {
+func (t *templateExec) Execute(templ tpl.Template, wr io.Writer, data any) error {
return t.ExecuteWithContext(context.Background(), templ, wr, data)
}
-func (t *templateExec) ExecuteWithContext(ctx context.Context, templ tpl.Template, wr io.Writer, data interface{}) error {
+func (t *templateExec) ExecuteWithContext(ctx context.Context, templ tpl.Template, wr io.Writer, data any) error {
if rlocker, ok := templ.(types.RLocker); ok {
rlocker.RLock()
defer rlocker.RUnlock()
diff --git a/tpl/tplimpl/template_ast_transformers_test.go b/tpl/tplimpl/template_ast_transformers_test.go
index 56d970b23..90ca325ab 100644
--- a/tpl/tplimpl/template_ast_transformers_test.go
+++ b/tpl/tplimpl/template_ast_transformers_test.go
@@ -88,7 +88,7 @@ func TestCollectInfo(t *testing.T) {
{"Basic config map", "{{ $_hugo_config := `" + configStr + "` }}", tpl.ParseInfo{Config: tpl.ParseConfig{Version: 42}}},
}
- echo := func(in interface{}) interface{} {
+ echo := func(in any) any {
return in
}
@@ -129,7 +129,7 @@ func TestPartialReturn(t *testing.T) {
`, true},
}
- echo := func(in interface{}) interface{} {
+ echo := func(in any) any {
return in
}
diff --git a/tpl/tplimpl/template_funcs.go b/tpl/tplimpl/template_funcs.go
index 0ecd5df46..e664bd6c5 100644
--- a/tpl/tplimpl/template_funcs.go
+++ b/tpl/tplimpl/template_funcs.go
@@ -174,7 +174,7 @@ func newTemplateExecuter(d *deps.Deps) (texttemplate.Executer, map[string]reflec
), funcsv
}
-func createFuncMap(d *deps.Deps) map[string]interface{} {
+func createFuncMap(d *deps.Deps) map[string]any {
funcMap := template.FuncMap{}
// Merge the namespace funcs