From 8cb79bb455618687d1bf6854b5d7f3999a7b9458 Mon Sep 17 00:00:00 2001 From: Josh Klopfenstein Date: Wed, 7 Jan 2026 15:31:31 -0800 Subject: [PATCH] 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 --- internal/build/file.go | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/internal/build/file.go b/internal/build/file.go index 2cd090c42c..d22a0aada1 100644 --- a/internal/build/file.go +++ b/internal/build/file.go @@ -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() {