Walk is less efficient than WalkDir, introduced in Go 1.16, which avoids calling os.Lstat on every visited file or directory.
The differences between WalkDirFunc compared to filepath.WalkFunc are:
The second argument has type fs.DirEntry instead of fs.FileInfo.
The function is called before reading a directory, to allow SkipDir to bypass the directory read entirely.
If a directory read fails, the function is called a second time for that directory to report the error.
This change would make some performance improvements when lots of directories are matched with given flagExcludedDirs pattern.
Currently, CompileDaemon requires Go 1.11 or higher but WalkDir are introduced in Go 1.16. Thus, Go 1.16 or higher version will be needed after merging this PR.
Feel free to close this PR if you don't want to update Go version now.
From Go 1.16 docs:
This change would make some performance improvements when lots of directories are matched with given
flagExcludedDirs
pattern.Currently, CompileDaemon requires Go 1.11 or higher but
WalkDir
are introduced in Go 1.16. Thus, Go 1.16 or higher version will be needed after merging this PR.Feel free to close this PR if you don't want to update Go version now.