feat(dir): continue on permission error (#1621)

This commit is contained in:
Richard Gomez authored and GitHub committed 2024-11-05 07:58:36 -06:00
1 parent 202106a190
commit c1add1d268
2 files changed
+12 -1

No files matched your search

+7
View File
@@ -20,9 +20,16 @@ func DirectoryTargets(source string, s *semgroup.Group, followSymlinks bool) (<-
defer close(paths)
return filepath.Walk(source,
func(path string, fInfo os.FileInfo, err error) error {
logger := log.With().Str("path", path).Logger()
if err != nil {
if os.IsPermission(err) {
// This seems to only fail on directories at this stage.
logger.Warn().Msg("Skipping directory: permission denied")
return filepath.SkipDir
}
return err
}
if fInfo.Name() == ".git" && fInfo.IsDir() {
return filepath.SkipDir
}