Standard library / text/template
text/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" "strings" "text/template")
func main() { t := template.Must(template.New("greet").Parse("Hello {{.}}")) fmt.Println(strings.Contains(t.DefinedTemplates(), `"greet"`))}