1
0
mirror of https://github.com/astaxie/beego.git synced 2024-11-22 15:20:54 +00:00

refactor(FileSystem): using single-line if

This commit is contained in:
Viktor Vassilyev 2018-11-07 20:21:34 +06:00
parent 9ac4928113
commit f193e313a3

6
fs.go
View File

@ -41,8 +41,7 @@ func walk(fs http.FileSystem, path string, info os.FileInfo, walkFn filepath.Wal
dir, err := fs.Open(path) dir, err := fs.Open(path)
defer dir.Close() defer dir.Close()
if err != nil { if err != nil {
err1 := walkFn(path, info, err) if err1 := walkFn(path, info, err); err1 != nil {
if err1 != nil {
return err1 return err1
} }
return err return err
@ -62,8 +61,7 @@ func walk(fs http.FileSystem, path string, info os.FileInfo, walkFn filepath.Wal
for _, fileInfo := range dirs { for _, fileInfo := range dirs {
filename := filepath.Join(path, fileInfo.Name()) filename := filepath.Join(path, fileInfo.Name())
err = walk(fs, filename, fileInfo, walkFn) if err = walk(fs, filename, fileInfo, walkFn); err != nil {
if err != nil {
if !fileInfo.IsDir() || err != filepath.SkipDir { if !fileInfo.IsDir() || err != filepath.SkipDir {
return err return err
} }