1
0
mirror of https://github.com/securego/gosec.git synced 2025-11-23 22:15:04 +02:00

perf: skip SSA analysis if no analyzers are loaded (#1419)

This commit is contained in:
Ian
2025-11-10 04:28:13 -05:00
committed by GitHub
parent 8a5d01aca5
commit 8b0d0b8871

View File

@@ -405,6 +405,11 @@ func (gosec *Analyzer) CheckRules(pkg *packages.Package) {
// CheckAnalyzers runs analyzers on a given package.
func (gosec *Analyzer) CheckAnalyzers(pkg *packages.Package) {
// significant performance improvement if no analyzers are loaded
if len(gosec.analyzerSet.Analyzers) == 0 {
return
}
ssaResult, err := gosec.buildSSA(pkg)
if err != nil || ssaResult == nil {
errMessage := "Error building the SSA representation of the package " + pkg.Name + ": "