mirror of
https://github.com/securego/gosec.git
synced 2024-12-26 04:25:52 +00:00
Improve logging in the analyser
Signed-off-by: Cosmin Cojocar <cosmin.cojocar@gmx.ch>
This commit is contained in:
parent
ea16ff1f9e
commit
85221996b6
1 changed files with 2 additions and 3 deletions
|
@ -114,7 +114,7 @@ func (gosec *Analyzer) Process(buildTags []string, packagePaths ...string) error
|
||||||
gosec.logger.Printf("Skipping: %s. Path doesn't exist.", abspath)
|
gosec.logger.Printf("Skipping: %s. Path doesn't exist.", abspath)
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
gosec.logger.Println("Searching directory:", abspath)
|
gosec.logger.Println("Import directory:", abspath)
|
||||||
|
|
||||||
basePackage, err := build.Default.ImportDir(packagePath, build.ImportComment)
|
basePackage, err := build.Default.ImportDir(packagePath, build.ImportComment)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
@ -133,7 +133,6 @@ func (gosec *Analyzer) Process(buildTags []string, packagePaths ...string) error
|
||||||
pkgs = append(pkgs, _pkgs...)
|
pkgs = append(pkgs, _pkgs...)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
for _, packageInfo := range pkgs {
|
for _, packageInfo := range pkgs {
|
||||||
if len(packageInfo.Errors) != 0 {
|
if len(packageInfo.Errors) != 0 {
|
||||||
for _, packErr := range packageInfo.Errors {
|
for _, packErr := range packageInfo.Errors {
|
||||||
|
@ -166,7 +165,7 @@ func (gosec *Analyzer) Process(buildTags []string, packagePaths ...string) error
|
||||||
sortErrors(gosec.errors) // sorts errors by line and column in the file
|
sortErrors(gosec.errors) // sorts errors by line and column in the file
|
||||||
|
|
||||||
for _, pkg := range pkgs {
|
for _, pkg := range pkgs {
|
||||||
gosec.logger.Println("Checking package:", pkg.String())
|
gosec.logger.Println("Checking package:", pkg.Name)
|
||||||
for _, file := range pkg.Syntax {
|
for _, file := range pkg.Syntax {
|
||||||
gosec.logger.Println("Checking file:", pkg.Fset.File(file.Pos()).Name())
|
gosec.logger.Println("Checking file:", pkg.Fset.File(file.Pos()).Name())
|
||||||
gosec.context.FileSet = pkg.Fset
|
gosec.context.FileSet = pkg.Fset
|
||||||
|
|
Loading…
Reference in a new issue