Skip to content

Commit

Permalink
Replace Walk with WalkDir, Walk is less efficient than WalkDir, intro…
Browse files Browse the repository at this point in the history
…duced in Go 1.16
  • Loading branch information
mstmdev committed Feb 3, 2022
1 parent d3c4063 commit cb9b43c
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion fs/delete.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ func IsDeleted(path string) bool {

// ClearDeletedFile remove all of the deleted files in the path
func ClearDeletedFile(clearPath string) error {
return filepath.Walk(clearPath, func(path string, info fs.FileInfo, err error) error {
return filepath.WalkDir(clearPath, func(path string, d fs.DirEntry, err error) error {
if err != nil && os.IsNotExist(err) {
return nil
}
Expand Down

0 comments on commit cb9b43c

Please sign in to comment.