r/golang•
b3b0p831

Why does filepath.WalkDir() skip remaining files and directories?

Hey y'all,

I'm working on this go project where I have to walk a directory and build a FileTree. However, I need to skip hidden files and directories.

I noticed that when you return SkipDir on a file, it skips the remaining files/dirs.

The documentation doesn't really mention this so I was wondering if I was doing something wrong!

I found this blog post with similar behavior: https://ixday.github.io/post/filepath_walk/

I'm curious as to why?

Posted Dec 3, 2025, 1:45 AM UTC

102
Loading comments…