diff --git a/core/analyzer.go b/core/analyzer.go index ea4ec0c..6d15353 100644 --- a/core/analyzer.go +++ b/core/analyzer.go @@ -16,6 +16,7 @@ package core import ( + "fmt" "go/ast" "go/importer" "go/parser" @@ -123,10 +124,9 @@ func (gas *Analyzer) process(filename string, source interface{}) error { } conf := types.Config{Importer: importer.Default()} - gas.context.Pkg, _ = conf.Check("pkg", gas.context.FileSet, []*ast.File{root}, gas.context.Info) + gas.context.Pkg, err = conf.Check("pkg", gas.context.FileSet, []*ast.File{root}, gas.context.Info) if err != nil { - gas.logger.Println("failed to check imports") - return err + return fmt.Errorf(`Error during type checking: "%s"`, err) } gas.context.Imports = NewImportInfo() diff --git a/main.go b/main.go index ea8070c..069e875 100644 --- a/main.go +++ b/main.go @@ -176,7 +176,7 @@ func main() { // Ensure at least one file was specified if flag.NArg() == 0 { - fmt.Fprintf(os.Stderr, "\nerror: FILE [FILE...] or './...' expected\n") + fmt.Fprintf(os.Stderr, "\nError: FILE [FILE...] or './...' expected\n") flag.Usage() os.Exit(1) } @@ -195,9 +195,11 @@ func main() { toAnalyze := getFilesToAnalyze(flag.Args(), excluded) for _, file := range toAnalyze { - logger.Printf("scanning \"%s\"\n", file) + logger.Printf(`Processing "%s"...`, file) if err := analyzer.Process(file); err != nil { - logger.Fatal(err) + logger.Printf(`Failed to process: "%s"`, file) + logger.Println(err) + logger.Fatalf(`Halting execution.`) } }