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) *TreeParameters & Attributes
| Name | Type | Description |
|---|---|---|
| name | string | Name of the template. |
| funcs | ...map[string]any | Input 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) }