Question: This is my directory structure:

```
app/
  template/
    layout/
      base.tmpl
    index.tmpl

```

`template.ParseGlob("*/*.tmpl")` parses `index.tmpl` but not `base.tmpl` in the `layout` subdirectory. Is there a way to parse all templates recursively?

Answer: 
if it is not deeply nested (if you know names of sub-directories beforehand) you can just do this:

```
t := template.Must(template.ParseGlob("template/*.tmpl"))
template.Must(t.ParseGlob("template/layout/*.tmpl"))

```

Then for each sub-directory do the same as for 'layout'
You can load multiple subdirectories this way. Here we ignore if subdirectories do not exist. But we want to make sure that the first directory can be loaded.

```
func ParseTemplates() (*template.Template, error) {
    templateBuilder := template.New("")
    if t, _ := templateBuilder.ParseGlob("/*/*/*/*/*.tmpl"); t != nil {
        templateBuilder = t
    }
    if t, _ := templateBuilder.ParseGlob("/*/*/*/*.tmpl"); t != nil {
        templateBuilder = t
    }
    if t, _ := templateBuilder.ParseGlob("/*/*/*.tmpl"); t != nil {
        templateBuilder = t
    }
    if t, _ := templateBuilder.ParseGlob("/*/*.tmpl"); t != nil {
        templateBuilder = t
    }
    return templateBuilder.ParseGlob("/*.tmpl")
}

```