func CreateTemplates() *template.Template {
	staticFS, err := fs.New()
	if err != nil {
		log.Fatal(err)
	}

	templates := template.New("")

	fs.Walk(staticFS, "/templates", func(path string, info os.FileInfo, err error) error {
		if !info.IsDir() {
			templateFile, err := staticFS.Open(path)
			if err != nil {
				log.Fatal(err)
			}

			templateData, err := ioutil.ReadAll(templateFile)
			if err != nil {
				log.Fatal(err)
			}
			// Multiple calls to Parse are appending templates
			templates.New(filepath.Base(path)).Parse(string(templateData))
		}

		return nil
	})

	return templates
}
// CreateTemplates creates templates from the template files statically built into the binary
CreateTemplates creates templates from the template files statically built into the binary
// CreateTemplates creates templates from the template files statically built into the binary
func CreateTemplates() *template.Template {
	staticFS, err := fs.New()
	if err != nil {
		log.Fatal(err)
	}
	templates := template.New("")
	fs.Walk(staticFS, "/templates", func(path string, info os.FileInfo, err error) error {
		if !info.IsDir() {
			templateFile, err := staticFS.Open(path)
			if err != nil {
				log.Fatal(err)
			}
			templateData, err := ioutil.ReadAll(templateFile)
			if err != nil {
				log.Fatal(err)
			}
			templates.New(filepath.Base(path)).Parse(string(templateData))
		}
		return nil
	})
	return templates
}
func CreateTemplates ( ) * template . Template { staticFS , err := fs . New ( ) if err != nil { log . Fatal ( err ) } templates := template . New ( " " ) fs . Walk ( staticFS , " " , func ( path string , info os . FileInfo , err error ) error { if ! info . IsDir ( ) { templateFile , err := staticFS . Open ( path ) if err != nil { log . Fatal ( err ) } templateData , err := ioutil . ReadAll ( templateFile ) if err != nil { log . Fatal ( err ) } templates . New ( filepath . Base ( path ) ) . Parse ( string ( templateData ) ) } return nil } ) return templates }
CreateTemplates creates templates from the template files statically built into the binary
CreateTemplates creates templates from the template files statically built into the binary
// Multiple calls to Parse are appending templates