1
0
mirror of https://github.com/golang/go synced 2024-11-18 10:54:40 -07:00

cmd/guru: fix assignment to entry in nil map.

Fixes golang/go#14746.

Change-Id: Id79c43c7d3700b98c010aa7dc0aac2463164be09
Reviewed-on: https://go-review.googlesource.com/20988
Reviewed-by: Alan Donovan <adonovan@google.com>
This commit is contained in:
David R. Jenni 2016-03-21 20:42:17 +01:00 committed by Alan Donovan
parent 936084890a
commit 21cc49bd03

View File

@ -174,7 +174,10 @@ func globalReferrers(q *Query, qpkg, defpkg string, objposn token.Position, isPk
// Only function bodies in those packages need type-checking.
var users map[string]bool
if isPkgLevel {
users = rev[defpkg] // direct importers
users = rev[defpkg] // direct importers
if users == nil {
users = make(map[string]bool)
}
users[defpkg] = true // plus the defining package itself
} else {
users = rev.Search(defpkg) // transitive importers