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: 
Not without implementing your own function to do it, I've been using something like this

```
func ParseTemplates() *template.Template {
    templ := template.New("")
    err := filepath.Walk("./views", func(path string, info os.FileInfo, err error) error {
        if strings.Contains(path, ".html") {
            _, err = templ.ParseFiles(path)
            if err != nil {
                log.Println(err)
            }
        }

        return err
    })

    if err != nil {
        panic(err)
    }

    return templ
}

```

This will parse all your templates then you can render them by calling their names e.g.

`template.ExecuteTemplate(w, "home", nil)`
I made a package that solves exactly this problem.

<https://github.com/karelbilek/template-parse-recursive>

```
package main

import (
    "html/template"
    "os"

    recurparse "github.com/karelbilek/template-parse-recursive"
)

func main() {
    t, err := recurparse.HTMLParse(
        template.New("templates"), 
        "path/to/templates", 
        "*.html",
    )

    if err != nil {
        panic(err)
    }

    templateUnder := t.Lookup("subdir/subdir/template.html")
    templateUnder.Execute(os.Stdout, nil)
}

```