mirror of
https://github.com/astaxie/beego.git
synced 2024-11-22 11:50:55 +00:00
close fs only when fs open without error
panic when close nil filesystem
This commit is contained in:
parent
b0e2bbce2a
commit
a5a2471f2c
@ -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