Golang html/template.Template.Templates function example
package html/template
Templates returns a slice of the templates associated with t, including t itself.
Golang html/template.Template.Templates function usage example
package main
import (
"fmt"
"html/template"
)
func main() {
t := template.New("HELLO")
t1 := template.Must(t.ParseGlob("*.html"))
templates := t1.Templates() // < -- here
fmt.Println("Total templates detected from ParseGlob : ", len(templates))
}
Sample output : (depending on how many *.html files in the detected)
Total templates detected from ParseGlob : 3
2 html files will be counted as 3 because Templates() include it self.
Reference :
Advertisement
Something interesting
Tutorials
+16k Golang : Get sub string example
+8.2k Golang : Reverse text lines or flip line order example
+25.9k Golang : How to read integer value from standard input ?
+8.1k Golang : HTTP Server Example
+5.3k Swift : Convert string array to array example
+4.6k JavaScript : Rounding number to decimal formats to display currency
+8.6k Golang : Progress bar with ∎ character
+9.7k PHP : Get coordinates latitude/longitude from string
+9.3k Golang : Generate EAN barcode
+9.5k Golang : Accessing content anonymously with Tor
+20.2k Golang : Reset or rewind io.Reader or io.Writer
+3.7k Java : Random alphabets, alpha-numeric or numbers only string generator