|
Briche Arnaud |
at Jul 26, 2013 at 3:10 pm
|
⇧ |
| |
Thx Christoph, I followed your suggestion and ended up with a simple :
template := template.New("template")
filepath.Walk("src/main/templates", func(path string, info os.FileInfo, err
error) error {
if strings.HasSuffix(path, ".html") {
template.ParseFiles(path)
}
return nil
})
Le vendredi 26 juillet 2013 15:29:52 UTC+2, Christoph Hack a écrit :
I don't know, but I would use filepath.Walk directly. For example:
err := filepath.Walk(root, func(path string, info os.FileInfo, err error)
error {
if err != nil {
return err; // you can also return nil here if you want to skip
files and directories that can not be accessed
}
if info.IsDir() || !strings.HasSuffix(".html") {
return nil // ignore directories and other files
}
err = parseFile(path)
return err
})
--
You received this message because you are subscribed to the Google Groups "golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email to
[email protected].
For more options, visit
https://groups.google.com/groups/opt_out.