Visible changes:
- "referrers" queries now emit a stream of results,
so they start appearing quickly even in large queries.
We no longer report the total number of matches.
- packageReferrers now also uses AfterTypeCheck hook and streaming.
- XML support has been dropped.
- The -format flag has been replaced by -json.
JSON protocol changes:
- The enclosing Result struct has been removed.
- Likewise the 'mode' field (since the caller knows it already)
- "freevars" and "referrers" now emit a stream of objects
In the case of referrers, the first object has a different from the rest.
- The "referrers" results include the text of the matching line
(parity with -json=false)
Implementation details:
- the concurrency-safe q.Output function can be called
many times, each with a queryResult to print.
- fset is no longer saved in Query (cleaner)
- queryResult methods renamed PrintPlain, JSON
Change-Id: I41a4e3f57f266fcf043ece4045bca82c6f6a356f
Reviewed-on: https://go-review.googlesource.com/21397
Reviewed-by: Michael Matloob <matloob@golang.org>
As an optimization, the callers and callstack queries now avoid the
relatively costly pointer analysis in some common cases:
The callers of a function that is never address-taken can be enumerated
directly from the SSA representation.
Similarly, the callstack can be computed initially by ignoring dynamic
call edges; we run the pointer analysis only if no path is found in this
partial callgraph. As a bonus, this also causes the tool to
preferentially report all-static callpaths.
A callers query on fmt.Errorf now completes in 3 seconds instead of 8,
and a callstack query completes in 2 seconds instead of 8.
The new code is covered by the existing tests.
Change-Id: I777ea07a1cdb6cadcc2a94952f553b6b036e7382
Reviewed-on: https://go-review.googlesource.com/19496
Reviewed-by: Michael Matloob <matloob@golang.org>