From 85221996b6d96935c4aa6e06b36415ba528ce077 Mon Sep 17 00:00:00 2001 From: Cosmin Cojocar Date: Thu, 25 Apr 2019 12:44:12 +0200 Subject: [PATCH] Improve logging in the analyser Signed-off-by: Cosmin Cojocar --- analyzer.go | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/analyzer.go b/analyzer.go index 4b66d4d..b186348 100644 --- a/analyzer.go +++ b/analyzer.go @@ -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