mirror of
https://github.com/securego/gosec.git
synced 2025-01-14 02:23:09 +02:00
Refactor AppendError to use strings.Contains (#1270)
This commit is contained in:
parent
b01f49e366
commit
4fda076e5d
@ -543,8 +543,7 @@ func (gosec *Analyzer) ParseErrors(pkg *packages.Package) error {
|
|||||||
// AppendError appends an error to the file errors
|
// AppendError appends an error to the file errors
|
||||||
func (gosec *Analyzer) AppendError(file string, err error) {
|
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)
|
// 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 strings.Contains(err.Error(), "no buildable Go source files in") {
|
||||||
if r.MatchString(err.Error()) {
|
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
errors := make([]Error, 0)
|
errors := make([]Error, 0)
|
||||||
|
Loading…
Reference in New Issue
Block a user