Standard library / html/template
html/template.Template.Name()
Returns the name assigned to this template. Expected stdout: 'greet\n'.
Formal Syntax & Structure
go syntaxgo
func (t *Template) Name() stringReturn Value
string
Returns the name assigned to this template.
Working Example
Example Snippetgo
package main
import ( "fmt" "html/template")
func main() { t := template.Must(template.New("greet").Parse("Hello {{.}}")); fmt.Println(t.Name()) }