diff --git a/core/analyzer.go b/core/analyzer.go index 82beb76..41904aa 100644 --- a/core/analyzer.go +++ b/core/analyzer.go @@ -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 } } } diff --git a/rules/rand.go b/rules/rand.go index 52469c7..54b6e6c 100644 --- a/rules/rand.go +++ b/rules/rand.go @@ -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 }