@@ -19,10 +19,9 @@ const (
1919
2020// findOptions configures file discovery behavior.
2121type findOptions struct {
22- targetFiles []string
23- includeGlobs []string
24- excludeGlobs []string
25- followSymlinks bool
22+ targetFiles []string
23+ includeGlobs []string
24+ excludeGlobs []string
2625}
2726
2827// FindOption is a functional option for configuring file discovery.
@@ -70,13 +69,6 @@ func WithExcludes(patterns ...string) FindOption {
7069 }
7170}
7271
73- // WithFollowSymlinks enables or disables following symbolic links.
74- func WithFollowSymlinks (follow bool ) FindOption {
75- return func (o * findOptions ) {
76- o .followSymlinks = follow
77- }
78- }
79-
8072// FindResult represents a discovered file.
8173type FindResult struct {
8274 Path string // Absolute path to the file
@@ -241,11 +233,6 @@ func walkDirectory(ctx context.Context, absRoot string, opts *findOptions) ([]Fi
241233 return handleDirectory (d , relPath , opts .excludeGlobs )
242234 }
243235
244- // Handle symlinks
245- if d .Type ()& fs .ModeSymlink != 0 && ! shouldFollowSymlink (path , relPath , opts .followSymlinks ) {
246- return nil
247- }
248-
249236 // Check exclusions and pattern match for files
250237 if shouldIncludeFile (d , relPath , opts ) {
251238 results = append (results , FindResult {
@@ -298,22 +285,6 @@ func handleDirectory(d fs.DirEntry, relPath string, excludePatterns []string) er
298285 return nil
299286}
300287
301- // shouldFollowSymlink determines if a symlink should be followed.
302- func shouldFollowSymlink (path , relPath string , followSymlinks bool ) bool {
303- if ! followSymlinks {
304- slog .Debug ("Skipping symlink" , slog .String (logKeyPath , relPath ))
305- return false
306- }
307-
308- // Resolve symlink and check if it's a file
309- targetInfo , err := os .Stat (path )
310- if err != nil || targetInfo .IsDir () {
311- return false
312- }
313-
314- return true
315- }
316-
317288// shouldIncludeFile determines if a file should be included in results.
318289// Returns true if the file matches any of the include globs and is not excluded.
319290func shouldIncludeFile (d fs.DirEntry , relPath string , opts * findOptions ) bool {
0 commit comments