Skip to content

Commit

Permalink
Refactor AppendError to use strings.Contains (#1270)
Browse files Browse the repository at this point in the history
  • Loading branch information
alexandear authored Dec 16, 2024
1 parent b01f49e commit 4fda076
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions analyzer.go
Original file line number Diff line number Diff line change
Expand Up @@ -543,8 +543,7 @@ func (gosec *Analyzer) ParseErrors(pkg *packages.Package) error {
// AppendError appends an error to the file errors
func (gosec *Analyzer) AppendError(file string, err error) {
// Do not report the error for empty packages (e.g. files excluded from build with a tag)
r := regexp.MustCompile(`no buildable Go source files in`)
if r.MatchString(err.Error()) {
if strings.Contains(err.Error(), "no buildable Go source files in") {
return
}
errors := make([]Error, 0)
Expand Down

0 comments on commit 4fda076

Please sign in to comment.