Template.ParseGlob("*.html") //fetches all html files from current directory.Template.ParseGlob("**/*.html") //Seems to only fetch at one level depth我不是在尋找“步行”解決方案。只是想知道這是否可能。我不太明白這期望什么“模式”。如果我能得到關于 ParseGlob 使用的模式的解釋,那也會很棒。
2 回答

墨色風雨
TA貢獻1853條經驗 獲得超6個贊
該代碼text/template/helper.go
提到
// The pattern is processed by filepath.Glob and must match at least one file.
filepath.Glob()
說“的模式的語法是一樣的Match
”
如果 name 與 shell 文件名模式匹配,則 Match 返回 true。
Match()的實現似乎并沒有**
區別對待 ' ',并且只將 ' *
' 視為匹配任何非分隔符字符序列。
這意味著 ' **
' 等價于 ' *
',這反過來又可以解釋為什么匹配僅在一個級別深度起作用。
- 2 回答
- 0 關注
- 202 瀏覽
添加回答
舉報
0/150
提交
取消