Skip to content

Commit a9f1b58

Browse files
committed
use Compile instead of MustCompile to avoid panic
1 parent 1474c8b commit a9f1b58

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

processor/file.go

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,10 @@ func NewDirectoryWalker(output chan<- *FileJob) *DirectoryWalker {
6666
output: output,
6767
}
6868
for _, exclude := range Exclude {
69-
directoryWalker.excludes = append(directoryWalker.excludes, regexp.MustCompile(exclude))
69+
regexpResult, err := regexp.Compile(exclude)
70+
if err == nil {
71+
directoryWalker.excludes = append(directoryWalker.excludes, regexpResult)
72+
}
7073
}
7174

7275
directoryWalker.buffer = cuba.New(directoryWalker.Walk, cuba.NewStack())

0 commit comments

Comments
 (0)