Skip to content

Commit a7e8162

Browse files
committed
Fix check_generate script and add it to ci
1 parent 8024d24 commit a7e8162

File tree

3 files changed

+9
-5
lines changed

3 files changed

+9
-5
lines changed

.circleci/config.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -194,6 +194,8 @@ jobs:
194194
- checkout
195195
- run:
196196
command: go run build/ci.go lint
197+
- run:
198+
command: go run build/ci.go check_generate
197199
tidy-geth:
198200
resource_class: small
199201
docker:

build/ci.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -378,7 +378,7 @@ func doCheckGenerate() {
378378

379379
for _, mod := range goModules {
380380
// Compute the origin hashes of all the files
381-
hashes, err := build.HashFolder(mod, []string{"tests/testdata", "build/cache", ".git"})
381+
hashes, err := build.HashFolder(mod, []string{"tests/testdata", "build/cache", ".git", ".jj"})
382382
if err != nil {
383383
log.Fatal("Error computing hashes", "err", err)
384384
}
@@ -388,7 +388,7 @@ func doCheckGenerate() {
388388
c.Dir = mod
389389
build.MustRun(c)
390390
// Check if generate file hashes have changed
391-
generated, err := build.HashFolder(mod, []string{"tests/testdata", "build/cache", ".git"})
391+
generated, err := build.HashFolder(mod, []string{"tests/testdata", "build/cache", ".git", ".jj"})
392392
if err != nil {
393393
log.Fatalf("Error re-computing hashes: %v", err)
394394
}

internal/build/file.go

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -40,9 +40,11 @@ func HashFolder(folder string, exlude []string) (map[string][32]byte, error) {
4040
res := make(map[string][32]byte)
4141
err := filepath.WalkDir(folder, func(path string, d os.DirEntry, _ error) error {
4242
// Skip anything that's exluded or not a regular file
43-
for _, skip := range exlude {
44-
if strings.HasPrefix(path, filepath.FromSlash(skip)) {
45-
return filepath.SkipDir
43+
if d.IsDir() {
44+
for _, skip := range exlude {
45+
if strings.HasPrefix(path, filepath.FromSlash(skip)) {
46+
return filepath.SkipDir
47+
}
4648
}
4749
}
4850
if !d.Type().IsRegular() {

0 commit comments

Comments
 (0)