Standard library / text/template/parse
text/template/parse.NewIdentifier()
Creates a function identifier node with the specified spelling. SetPos and SetTree attach source metadata if needed. Expected stdout: 'true\n'.
Formal Syntax & Structure
go syntaxgo
func NewIdentifier(ident string) *IdentifierNodeParameters & Attributes
| Name | Type | Description |
|---|---|---|
| ident | string | Input to the operation as described above. |
Return Value
*IdentifierNode
Creates a function identifier node with the specified spelling.
Working Example
Example Snippetgo
package main
import ( "fmt" "text/template/parse")
func main() { n := parse.NewIdentifier("printf") fmt.Println(n.Ident == "printf" && n.Type() == parse.NodeIdentifier)}