mirror of
https://github.com/securego/gosec.git
synced 2025-11-25 22:22:17 +02:00
Track only the import from the file which is checked
Signed-off-by: Cosmin Cojocar <cosmin.cojocar@gmx.ch>
This commit is contained in:
committed by
Cosmin Cojocar
parent
f1ea7f6ee3
commit
5ef2beeaa6
@@ -175,7 +175,7 @@ func (gosec *Analyzer) check(pkg *packages.Package) {
|
||||
gosec.context.Pkg = pkg.Types
|
||||
gosec.context.PkgFiles = pkg.Syntax
|
||||
gosec.context.Imports = NewImportTracker()
|
||||
gosec.context.Imports.TrackPackages(gosec.context.Pkg.Imports()...)
|
||||
gosec.context.Imports.TrackFile(file)
|
||||
ast.Walk(gosec, file)
|
||||
gosec.stats.NumFiles++
|
||||
gosec.stats.NumLines += pkg.Fset.File(file.Pos()).LineCount()
|
||||
|
||||
Reference in New Issue
Block a user