Standard library / html/template
html/template.Template.DefinedTemplates()
Returns descriptive text listing defined templates; do not depend on its ordering. Expected stdout: 'true\n'.
Formal Syntax & Structure
go syntaxgo
func (t *Template) DefinedTemplates() stringReturn Value
string
Returns descriptive text listing defined templates; do not depend on its ordering.
Working Example
Example Snippetgo
package main
import ( "fmt" "html/template" "strings")
func main() { t := template.Must(template.New("greet").Parse("Hello {{.}}")) fmt.Println(strings.Contains(t.DefinedTemplates(), `"greet"`))}