mirror of
https://github.com/astaxie/beego.git
synced 2024-11-22 12:30:54 +00:00
Merge pull request #3419 from xpzouying/close_fs_when_is_not_nil
Close fs when is not nil
This commit is contained in:
commit
8152ade1b6
@ -186,13 +186,13 @@ func BuildTemplate(dir string, files ...string) error {
|
||||
var err error
|
||||
fs := beeTemplateFS()
|
||||
f, err := fs.Open(dir)
|
||||
defer f.Close()
|
||||
if err != nil {
|
||||
if os.IsNotExist(err) {
|
||||
return nil
|
||||
}
|
||||
return errors.New("dir open err")
|
||||
}
|
||||
defer f.Close()
|
||||
|
||||
beeTemplates, ok := beeViewPathTemplates[dir]
|
||||
if !ok {
|
||||
|
Loading…
Reference in New Issue
Block a user