Golang html/template.Template.Name and New functions example

package html/template

Name returns the name of the template.

New allocates a new HTML template associated with the given one and with the same delimiters. The association, which is transitive, allows one template to invoke another with a {{template}} action.

Golang html/template.Template.Name and New functions usage example

 package main

 import (
 "fmt"
 "html/template"
 )

 func main() {

 t := template.New("HELLO")

 fmt.Println("Template name is : ", t.Name())

 }

Output :

Template name is : HELLO

References :

http://golang.org/pkg/html/template/#Template.Name

http://golang.org/pkg/html/template/#Template.New

Advertisement