Skip to content

Commit

Permalink
use Compile instead of MustCompile to avoid panic
Browse files Browse the repository at this point in the history
  • Loading branch information
foxdd committed Jul 17, 2021
1 parent 1474c8b commit a9f1b58
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion processor/file.go
Expand Up @@ -66,7 +66,10 @@ func NewDirectoryWalker(output chan<- *FileJob) *DirectoryWalker {
output: output,
}
for _, exclude := range Exclude {
directoryWalker.excludes = append(directoryWalker.excludes, regexp.MustCompile(exclude))
regexpResult, err := regexp.Compile(exclude)
if err == nil {
directoryWalker.excludes = append(directoryWalker.excludes, regexpResult)
}
}

directoryWalker.buffer = cuba.New(directoryWalker.Walk, cuba.NewStack())
Expand Down

0 comments on commit a9f1b58

Please sign in to comment.