Standard library / text/template/parse
text/template/parse.ActionNode.String()
String serializes this node as template syntax, not rendered output or guaranteed exact original whitespace. Expected stdout: 'true\n'.
Formal Syntax & Structure
go syntaxgo
func (a *ActionNode) String() stringReturn Value
string
String serializes this node as template syntax, not rendered output or guaranteed exact original whitespace.
Working Example
Example Snippetgo
package main
import ( "fmt" "text/template/parse")
func tree(s string) *parse.Tree { t := parse.New("demo") t.Mode = parse.ParseComments | parse.SkipFuncCheck _, e := t.Parse(s, "", "", map[string]*parse.Tree{}) if e != nil { panic(e) } return t}func action(s string) *parse.ActionNode { return tree(s).Root.Nodes[0].(*parse.ActionNode) }
func main() { t := tree("{{.Name}}") n := t.Root.Nodes[0].(*parse.ActionNode) fmt.Println(len(n.String()) > 0)}