Fix alias logic

This commit is contained in:
Grant Murphy 2016-11-07 20:10:30 -08:00
parent c833bfae02
commit be96ef273d
2 changed files with 2 additions and 4 deletions

View file

@ -203,7 +203,7 @@ func (gas *Analyzer) Visit(n ast.Node) ast.Visitor {
gas.context.Imports.InitOnly[path] = true
} else {
// Aliased import
gas.context.Imports.Aliased[imported.Name.Name] = path
gas.context.Imports.Aliased[path] = imported.Name.Name
}
}
}

View file

@ -27,9 +27,7 @@ type WeakRand struct {
}
func (w *WeakRand) Match(n ast.Node, c *gas.Context) (*gas.Issue, error) {
node, _ := gas.MatchCallByPackage(n, c, w.packagePath, w.funcName)
if node != nil {
if _, matched := gas.MatchCallByPackage(n, c, w.packagePath, w.funcName); matched {
return gas.NewIssue(c, n, w.What, w.Severity, w.Confidence), nil
}