ci: do not abort prematurely when hashing files

If an excluded directory was the prefix of a file (e.g.,
.git and .gitattributes), the returned file.SkipDir error
would instruct filepath.WalkDir to abort.

Originally discussed in https://github.com/ethereum-optimism/op-geth/pull/741
This commit is contained in:
Josh Klopfenstein 2026-01-07 15:31:31 -08:00
parent 5e6f7374de
commit 8cb79bb455

View file

@ -31,11 +31,13 @@ func HashFolder(folder string, exlude []string) (map[string][32]byte, error) {
res := make(map[string][32]byte)
err := filepath.WalkDir(folder, func(path string, d os.DirEntry, _ error) error {
// Skip anything that's exluded or not a regular file
if d.IsDir() {
for _, skip := range exlude {
if strings.HasPrefix(path, filepath.FromSlash(skip)) {
return filepath.SkipDir
}
}
}
if !d.Type().IsRegular() {
return nil
}