diff --git a/unused/unused.go b/unused/unused.go index 454c78e53..279621614 100644 --- a/unused/unused.go +++ b/unused/unused.go @@ -591,6 +591,10 @@ func (c *Checker) results() []types.Object { var out []types.Object if c.WholeProgram { + if c.graph == nil { + // We never analyzed any packages + return nil + } var ifaces []*types.Interface var notIfaces []types.Type