From 21cc49bd030cf5c6ebaca2fa0e3323628efed6d8 Mon Sep 17 00:00:00 2001 From: "David R. Jenni" Date: Mon, 21 Mar 2016 20:42:17 +0100 Subject: [PATCH] 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 --- cmd/guru/referrers.go | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/cmd/guru/referrers.go b/cmd/guru/referrers.go index 6a2ce16209..15fcf04c44 100644 --- a/cmd/guru/referrers.go +++ b/cmd/guru/referrers.go @@ -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