allFiles iterates over all files in fsys starting at root. It silently ignores errors.
(fsys fs.FS, root string)
| 426 | // allFiles iterates over all files in fsys starting at root. It silently |
| 427 | // ignores errors. |
| 428 | func allFiles(fsys fs.FS, root string) iter.Seq2[string, fs.DirEntry] { |
| 429 | return func(yield func(string, fs.DirEntry) bool) { |
| 430 | _ = fs.WalkDir(fsys, root, func(path string, d fs.DirEntry, err error) error { |
| 431 | if err == nil { |
| 432 | if !yield(path, d) { |
| 433 | return filepath.SkipAll |
| 434 | } |
| 435 | } |
| 436 | return nil |
| 437 | }) |
| 438 | } |
| 439 | } |
| 440 | |
| 441 | // lookPath is like [exec.lookPath], but first checks if there's an environment |
| 442 | // variable with the name prog. If there is, it returns $prog/bin/prog instead |