mirror of
https://github.com/gohugoio/hugo.git
synced 2025-08-30 22:39:58 +02:00
tpl: Sync go_templates for Go 1.18
Using Go tag go1.18 4aa1efed4853ea067d665a952eee77c52faac774 Updates #9677
This commit is contained in:
@@ -118,7 +118,7 @@ func (t *Template) escape() error {
|
||||
// the output writer.
|
||||
// A template may be executed safely in parallel, although if parallel
|
||||
// executions share a Writer the output may be interleaved.
|
||||
func (t *Template) Execute(wr io.Writer, data interface{}) error {
|
||||
func (t *Template) Execute(wr io.Writer, data any) error {
|
||||
if err := t.escape(); err != nil {
|
||||
return err
|
||||
}
|
||||
@@ -132,7 +132,7 @@ func (t *Template) Execute(wr io.Writer, data interface{}) error {
|
||||
// the output writer.
|
||||
// A template may be executed safely in parallel, although if parallel
|
||||
// executions share a Writer the output may be interleaved.
|
||||
func (t *Template) ExecuteTemplate(wr io.Writer, name string, data interface{}) error {
|
||||
func (t *Template) ExecuteTemplate(wr io.Writer, name string, data any) error {
|
||||
tmpl, err := t.lookupAndEscapeTemplate(name)
|
||||
if err != nil {
|
||||
return err
|
||||
@@ -336,7 +336,7 @@ func (t *Template) Name() string {
|
||||
// terminates and Execute returns that error. FuncMap has the same base type
|
||||
// as FuncMap in "text/template", copied here so clients need not import
|
||||
// "text/template".
|
||||
type FuncMap map[string]interface{}
|
||||
type FuncMap map[string]any
|
||||
|
||||
// Funcs adds the elements of the argument map to the template's function map.
|
||||
// It must be called before the template is parsed.
|
||||
@@ -487,7 +487,7 @@ func parseGlob(t *Template, pattern string) (*Template, error) {
|
||||
// IsTrue reports whether the value is 'true', in the sense of not the zero of its type,
|
||||
// and whether the value has a meaningful truth value. This is the definition of
|
||||
// truth used by if and other such actions.
|
||||
func IsTrue(val interface{}) (truth, ok bool) {
|
||||
func IsTrue(val any) (truth, ok bool) {
|
||||
return template.IsTrue(val)
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user