From f5693c4393730855f6daa8b0c1661dbc5dde6b44 Mon Sep 17 00:00:00 2001 From: John Guo Date: Thu, 10 Mar 2022 09:48:19 +0800 Subject: [PATCH] improve package gview --- os/gview/gview_parse.go | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/os/gview/gview_parse.go b/os/gview/gview_parse.go index b83096349..c1ac0cad6 100644 --- a/os/gview/gview_parse.go +++ b/os/gview/gview_parse.go @@ -60,7 +60,7 @@ var ( // and returns the parsed template content. func (view *View) Parse(ctx context.Context, file string, params ...Params) (result string, err error) { var tpl interface{} - // It caches the file, folder and its content to enhance performance. + // It caches the file, folder and content to enhance performance. r := view.fileCacheMap.GetOrSetFuncLock(file, func() interface{} { var ( path string @@ -272,10 +272,9 @@ func (view *View) getTemplate(filePath, folderPath, pattern string) (tpl interfa } } - // Secondly checking the file system. - var ( - files []string - ) + // Secondly checking the file system, + // and then automatically parsing all its sub-files recursively. + var files []string files, err = gfile.ScanDir(folderPath, pattern, true) if err != nil { return nil