mirror of
https://github.com/astaxie/beego.git
synced 2024-11-22 17:30:56 +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
|
var err error
|
||||||
fs := beeTemplateFS()
|
fs := beeTemplateFS()
|
||||||
f, err := fs.Open(dir)
|
f, err := fs.Open(dir)
|
||||||
defer f.Close()
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
if os.IsNotExist(err) {
|
if os.IsNotExist(err) {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
return errors.New("dir open err")
|
return errors.New("dir open err")
|
||||||
}
|
}
|
||||||
|
defer f.Close()
|
||||||
|
|
||||||
beeTemplates, ok := beeViewPathTemplates[dir]
|
beeTemplates, ok := beeViewPathTemplates[dir]
|
||||||
if !ok {
|
if !ok {
|
||||||
|
Loading…
Reference in New Issue
Block a user