unused: don't discard cross-package edges in whole program mode
Closes
@@ -861,6 +861,7 @@ func (g *Graph) use(used, by interface{}, reason string) {
if _, ok := by.(*types.Func); ok {
assert(g.pkg.Prog.FuncValue(by.(*types.Func)) == nil)
}
+ if !g.wholeProgram {
if obj, ok := used.(types.Object); ok && obj.Pkg() != nil {
if obj.Pkg() != g.pkg.Pkg {
return
@@ -871,6 +872,7 @@ func (g *Graph) use(used, by interface{}, reason string) {
return
}
}
+ }
usedNode, new := g.node(used)
assert(!new)
if by == nil {
