Skip to content

Commit

Permalink
feat: update Walk to Walkdir
Browse files Browse the repository at this point in the history
WalkDir is more efficient than Walk. WalkDir was introduced in Go 1.16 and avoids calling os.Lstat on every visited file or directory
  • Loading branch information
d-Rickyy-b committed Jul 4, 2021
1 parent b3c99ef commit 9604540
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -79,8 +79,8 @@ func getFiles(sourcePath string, unit config.Unit) ([]archiver.BackupFileMetadat
}

// Recursively check directories for files. Add all that do not match the exclusion filters
err := filepath.Walk(sourcePath,
func(path string, info os.FileInfo, err error) error {
err := filepath.WalkDir(sourcePath,
func(path string, info fs.DirEntry, err error) error {
if err != nil {
return err
}
Expand Down

0 comments on commit 9604540

Please sign in to comment.