Standard library / text/template

text/template.New()

Creates a named, initially undefined template. Expected stdout: 'greet\n'.

Formal Syntax & Structure

go syntaxgo
func New(name string) *Template

Parameters & Attributes

NameTypeDescription
namestringName of the template.

Return Value

*Template

Creates a named, initially undefined template.

Working Example

Example Snippetgo
package main
import (  "fmt"  "text/template")
func main() { t := template.New("greet"); fmt.Println(t.Name()) }
Go Reference