Remove dead code in symlink handling

filepath.Walk uses Lstat, so symlinks are reported with ModeSymlink set,
never ModeDir. The info.IsDir() check was always false, making the
filepath.SkipDir branch unreachable dead code.
Этот коммит содержится в:
2026-02-02 13:15:39 -08:00
родитель 86764abadf
Коммит d848c5e51b

Просмотреть файл

@@ -397,10 +397,9 @@ func countFiles(root string) int64 {
if err != nil {
return nil
}
// Skip symlinks - note: filepath.Walk uses Lstat, so symlinks are
// reported as ModeSymlink, never as directories. Walk doesn't follow them.
if info.Mode()&os.ModeSymlink != 0 {
if info.IsDir() {
return filepath.SkipDir
}
return nil
}
rel, _ := filepath.Rel(root, p)
@@ -456,14 +455,12 @@ func walkAndProcess(root string, stats *Stats, description string, fn func(strin
return err
}
// skip symlinks entirely
// Skip symlinks - filepath.Walk uses Lstat, so symlinks are reported
// as ModeSymlink, never as directories. Walk doesn't follow them.
if info.Mode()&os.ModeSymlink != 0 {
if verbose && !quiet {
log.Printf("skip symlink %s", p)
}
if info.IsDir() {
return filepath.SkipDir
}
return nil
}