Standard library / text/template/parse

text/template/parse.New()

Allocates an unparsed named tree; use Parse to populate its root. Expected stdout: 'true\n'.

Formal Syntax & Structure

go syntaxgo
func New(name string, funcs ...map[string]any) *Tree

Parameters & Attributes

NameTypeDescription
namestringName of the template.
funcs...map[string]anyInput to the operation as described above.

Return Value

*Tree

Allocates an unparsed named tree; use Parse to populate its root.

Working Example

Example Snippetgo
package main
import (  "fmt"  "text/template/parse")
func main() { t := parse.New("demo"); fmt.Println(t.Name == "demo" && t.Root == nil) }
Go Reference