ParseGlob:在目录中递归解析所有模板的模式是什么?

Gna*_*ani 3 go go-templates

Template.ParseGlob("*.html") //fetches all html files from current directory.
Template.ParseGlob("**/*.html") //Seems to only fetch at one level depth
Run Code Online (Sandbox Code Playgroud)

我不是在寻找"Walk"解决方案.只是想知道这是否可行.我不太明白这种期望的"模式".如果我可以得到关于ParseGlob使用的模式的解释,那也很棒.

Von*_*onC 6

代码text/template/helper.go提到

 // The pattern is processed by filepath.Glob and must match at least one file.
Run Code Online (Sandbox Code Playgroud)

filepath.Glob()说"模式的语法与"相同Match"

如果name与shell文件名模式匹配,则Match返回true.

Match()实现似乎并没有**区别对待,只考虑' *'匹配任何非分隔符字符序列.
这意味着' **'相当于' *',这反过来将解释为什么匹配只在一个级别深度工作.