chore: log skipped symlinks (#1591)

This commit is contained in:
Richard Gomez authored and GitHub committed 2024-10-22 08:23:10 -05:00
1 parent d03d6c401b
commit 5407c44e0c
2 files changed
+16 -9

No files matched your search

+7 -2
View File
@@ -1,12 +1,12 @@
package sources
import (
"github.com/rs/zerolog/log"
"io/fs"
"os"
"path/filepath"
"github.com/fatih/semgroup"
"github.com/rs/zerolog/log"
)
type ScanTarget struct {
@@ -35,7 +35,12 @@ func DirectoryTargets(source string, s *semgroup.Group, followSymlinks bool) (<-
Symlink: "",
}
}
if fInfo.Mode().Type() == fs.ModeSymlink && followSymlinks {
if fInfo.Mode().Type() == fs.ModeSymlink {
if !followSymlinks {
log.Debug().Str("path", path).Msg("Skipping symlink")
return nil
}
realPath, err := filepath.EvalSymlinks(path)
if err != nil {
return err