Skip to content

Commit 4fda076

Browse files
authored
Refactor AppendError to use strings.Contains (#1270)
1 parent b01f49e commit 4fda076

File tree

1 file changed

+1
-2
lines changed

1 file changed

+1
-2
lines changed

analyzer.go

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -543,8 +543,7 @@ func (gosec *Analyzer) ParseErrors(pkg *packages.Package) error {
543543
// AppendError appends an error to the file errors
544544
func (gosec *Analyzer) AppendError(file string, err error) {
545545
// Do not report the error for empty packages (e.g. files excluded from build with a tag)
546-
r := regexp.MustCompile(`no buildable Go source files in`)
547-
if r.MatchString(err.Error()) {
546+
if strings.Contains(err.Error(), "no buildable Go source files in") {
548547
return
549548
}
550549
errors := make([]Error, 0)

0 commit comments

Comments
 (0)