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'
With the answer of pete911 I could create this function to parse all the html templates on multiple subdirectories.

```golang
// parse.go
func ParseHtmlTemplates() *template.Template {
    var directories []string
    var filenames []string

    // Root directory of template files
    root := "./templates"

    // Get all directories on /templates and check if there's repeated files
    err := filepath.Walk(root, func(path string, info os.FileInfo, err error) error {
        if !info.IsDir() {
            // Is file
            filename := info.Name()

            hasRepeatedFiles := contains(filenames, filename)
            if hasRepeatedFiles {
                return fmt.Errorf("You can't have repeated template files: %s", filename)
            }

            filenames = append(filenames, filename)
        } else {
            // Is directory
            directories = append(directories, path)
        }

        return nil
    })
    if err != nil {
        fmt.Println(err)
        os.Exit(1)
    }

    // Create a template for parsing all directories
    tmpl := template.Must(template.ParseGlob(root + "/*.html"))

    // Parse all directories (minus the root directory)
    for _, path := range directories[1:] {
        pattern := path + "/*.html"
        template.Must(tmpl.ParseGlob(pattern))
    }

    return tmpl
}

// contains private method
func contains(filenames []string, filename string) bool {
    for _, f := range filenames {
        if f == filename {
            return true
        }
    }
    return false
}

// main.go
func main() {
    tmpl = ParseHtmlTemplates()
    if err := tmpl.Execute(os.Stdout, ""); err != nil {
        panic(err)
    }
}

```