From 959a356153744ebdc13f20102ca7e6d2f080d8e0 Mon Sep 17 00:00:00 2001 From: nxshock Date: Fri, 17 Mar 2023 21:16:04 +0500 Subject: [PATCH] Speedup filesystem walking by removing calling os.Lstat on each item --- backuper.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/backuper.go b/backuper.go index 566ed88..a2b4516 100644 --- a/backuper.go +++ b/backuper.go @@ -348,7 +348,7 @@ func (b *Config) index() (*Index, error) { fileMask := filepath.Join(filepath.Dir(b.filePath), b.FileName+"*"+defaultExt) var files []string - err := filepath.Walk(filepath.Dir(b.filePath), func(path string, info os.FileInfo, err error) error { + err := filepath.WalkDir(filepath.Dir(b.filePath), func(path string, info os.DirEntry, err error) error { matched, err := filepath.Match(fileMask, path) if err != nil { return fmt.Errorf("filepath.Match: %v", err)