Improve logging in the analyser

Signed-off-by: Cosmin Cojocar <cosmin.cojocar@gmx.ch>
This commit is contained in:
Cosmin Cojocar 2019-04-25 12:44:12 +02:00 committed by Grant Murphy
parent ea16ff1f9e
commit 85221996b6

View file

@ -114,7 +114,7 @@ func (gosec *Analyzer) Process(buildTags []string, packagePaths ...string) error
gosec.logger.Printf("Skipping: %s. Path doesn't exist.", abspath)
continue
}
gosec.logger.Println("Searching directory:", abspath)
gosec.logger.Println("Import directory:", abspath)
basePackage, err := build.Default.ImportDir(packagePath, build.ImportComment)
if err != nil {
@ -133,7 +133,6 @@ func (gosec *Analyzer) Process(buildTags []string, packagePaths ...string) error
pkgs = append(pkgs, _pkgs...)
}
for _, packageInfo := range pkgs {
if len(packageInfo.Errors) != 0 {
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
for _, pkg := range pkgs {
gosec.logger.Println("Checking package:", pkg.String())
gosec.logger.Println("Checking package:", pkg.Name)
for _, file := range pkg.Syntax {
gosec.logger.Println("Checking file:", pkg.Fset.File(file.Pos()).Name())
gosec.context.FileSet = pkg.Fset