mirror of
https://github.com/securego/gosec.git
synced 2024-11-05 19:45:51 +00:00
Handle import error rather than panic on failure
This should handle issue #9 more gracefully.
This commit is contained in:
parent
9ce14dc683
commit
2f84b67a47
1 changed files with 4 additions and 1 deletions
|
@ -83,7 +83,10 @@ 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)
|
||||
// TODO: we need to look at the err ret
|
||||
if err != nil {
|
||||
gas.logger.Println("failed to check imports")
|
||||
return err
|
||||
}
|
||||
|
||||
ast.Walk(gas, root)
|
||||
gas.Stats.NumFiles++
|
||||
|
|
Loading…
Reference in a new issue