mirror of
https://github.com/securego/gosec.git
synced 2024-11-05 19:45:51 +00:00
Expose analyzer API (#366)
Make it possible to use gosec from e.g. golangci-lint without modification of gosec.
This commit is contained in:
parent
29fddff3b4
commit
b9c4c66295
1 changed files with 3 additions and 2 deletions
|
@ -125,7 +125,7 @@ func (gosec *Analyzer) Process(buildTags []string, packagePaths ...string) error
|
|||
if err != nil {
|
||||
return fmt.Errorf("parsing errors in pkg %q: %v", pkg.Name, err)
|
||||
}
|
||||
gosec.check(pkg)
|
||||
gosec.Check(pkg)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -180,7 +180,8 @@ func (gosec *Analyzer) load(pkgPath string, conf *packages.Config) ([]*packages.
|
|||
return pkgs, nil
|
||||
}
|
||||
|
||||
func (gosec *Analyzer) check(pkg *packages.Package) {
|
||||
// Check runs analysis on the given package
|
||||
func (gosec *Analyzer) Check(pkg *packages.Package) {
|
||||
gosec.logger.Println("Checking package:", pkg.Name)
|
||||
for _, file := range pkg.Syntax {
|
||||
gosec.logger.Println("Checking file:", pkg.Fset.File(file.Pos()).Name())
|
||||
|
|
Loading…
Reference in a new issue