mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-07-21 20:26:41 +00:00
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:
parent
5e6f7374de
commit
8cb79bb455
1 changed files with 5 additions and 3 deletions
|
|
@ -31,9 +31,11 @@ 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
|
||||
for _, skip := range exlude {
|
||||
if strings.HasPrefix(path, filepath.FromSlash(skip)) {
|
||||
return filepath.SkipDir
|
||||
if d.IsDir() {
|
||||
for _, skip := range exlude {
|
||||
if strings.HasPrefix(path, filepath.FromSlash(skip)) {
|
||||
return filepath.SkipDir
|
||||
}
|
||||
}
|
||||
}
|
||||
if !d.Type().IsRegular() {
|
||||
|
|
|
|||
Loading…
Reference in a new issue