From 7540b1efba864901c1dc00833a72cb9ed306c52f Mon Sep 17 00:00:00 2001 From: 1911860538 Date: Wed, 14 May 2025 23:23:00 +0800 Subject: [PATCH] text/template: rename builtinFuncsOnce to builtinFuncs --- src/text/template/funcs.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/text/template/funcs.go b/src/text/template/funcs.go index ee45591f2e..c28c3ea200 100644 --- a/src/text/template/funcs.go +++ b/src/text/template/funcs.go @@ -62,8 +62,8 @@ func builtins() FuncMap { } } -// builtinFuncsOnce lazily computes & caches the builtinFuncs map. -var builtinFuncsOnce = sync.OnceValue(func() map[string]reflect.Value { +// builtinFuncs lazily computes & caches the builtinFuncs map. +var builtinFuncs = sync.OnceValue(func() map[string]reflect.Value { funcMap := builtins() m := make(map[string]reflect.Value, len(funcMap)) addValueFuncs(m, funcMap) @@ -136,7 +136,7 @@ func findFunction(name string, tmpl *Template) (v reflect.Value, isBuiltin, ok b return fn, false, true } } - if fn := builtinFuncsOnce()[name]; fn.IsValid() { + if fn := builtinFuncs()[name]; fn.IsValid() { return fn, true, true } return reflect.Value{}, false, false