Skip to content

Commit

Permalink
Merge pull request #272 from foxdd/master
Browse files Browse the repository at this point in the history
use Compile instead of MustCompile to avoid panic
  • Loading branch information
boyter committed Jul 20, 2021
2 parents 6130432 + 2ae31e6 commit b2ed0c8
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion processor/file.go
Expand Up @@ -66,7 +66,12 @@ 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)
} else {
printError(err.Error())
}
}

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

0 comments on commit b2ed0c8

Please sign in to comment.