Skip to content

Commit

Permalink
Handle WalkDir errors
Browse files Browse the repository at this point in the history
This is causing a panic so we don't know what the underlying error is.

Signed-off-by: Jon Johnson <[email protected]>
  • Loading branch information
jonjohnsonjr committed Dec 12, 2024
1 parent 8db01eb commit e713bf5
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions pkg/linter/linter.go
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,9 @@ func allPaths(fn func(ctx context.Context, pkgname, path string) error) func(ctx
if err := ctx.Err(); err != nil {
return err
}
if err != nil {
return err
}
if d.IsDir() {
// Ignore directories
return nil
Expand Down Expand Up @@ -286,7 +289,6 @@ func worldWriteableLinter(ctx context.Context, pkgname string, fsys fs.FS) error
if err := ctx.Err(); err != nil {
return err
}

if err != nil {
return err
}
Expand Down Expand Up @@ -389,9 +391,12 @@ func strippedLinter(ctx context.Context, _ string, fsys fs.FS) error {
})
}

func emptyLinter(_ context.Context, pkgname string, fsys fs.FS) error {
func emptyLinter(ctx context.Context, pkgname string, fsys fs.FS) error {
foundfile := false
err := fs.WalkDir(fsys, ".", func(path string, d fs.DirEntry, err error) error {
if err := ctx.Err(); err != nil {
return err
}
if err != nil {
return err
}
Expand Down

0 comments on commit e713bf5

Please sign in to comment.