FAQ
Reviewers: crawshaw1,

Message:
Hello crawshaw@google.com (cc: golang-dev@googlegroups.com),

I'd like you to review this change to
https://code.google.com/p/go.tools


Description:
go.tools/oracle: add option to output results in JSON syntax.

Each <query>Result structure has been "lowered" so that all
but the most trivial logic in each display() function has been
moved to the main query.

Each one now implements json.Marshaler, by constructiong the
appropriate type in json.go and then encoding it. Though the
<query>Result structs are similar to them, they're not close
enough; for exampe, JSON only gets "file:line:col" position
info whereas the -format=plain mode gets start/end intervals.

It's not always clear what the ideal level of abstraction is
for the JSON output. e.g. 'callgraph' returns the graph as a
set of vertices and edges, but perhaps it should show the same
spanning tree as in the -format=plain output?

Example usage:
% oracle -format=json -mode=callgraph
code.google.com/p/go.tools/cmd/oracle

Details:
- the display() method no longer needs an *oracle param, only
    a print function.
- eliminated the 'caller CallGraphNode' parameter from
    pointer.Context.Call callback since it was redundant w.r.t
    site.Caller().
- callees: sort the result for determinism.
- callees: compute the union across all contexts.
- callers: sort the results for determinism.
- describe(package): fixed a bug in the predicate for method
    accessibility: an unexported method defined in pkg A may
    belong to a type defined in package B (via
    embedding/promotion) and may thus be accessible to A. New
    accessibleMethods() utility fixes this.
- describe(type): filter methods by accessibility.
- added test of 'callgraph'.

No tests yet.

Please review this at https://codereview.appspot.com/13270045/

Affected files:
    M oracle/callees.go
    oracle/callers.go
    M oracle/callgraph.go
    M oracle/callstack.go
    M oracle/describe.go
    M oracle/freevars.go
    M oracle/implements.go
    A oracle/json.go
    M oracle/oracle_test.go
    A oracle/testdata/src/main/callgraph.go
    oracle/testdata/src/main/callgraph.golden
    oracle/testdata/src/main/calls.golden
    oracle/testdata/src/main/describe.golden
    M oracle/testdata/src/main/freevars.golden
    M oracle/testdata/src/main/peers.golden
    M pointer/analysis.go
    M pointer/api.go
    pointer/callgraph.go


--

---
You received this message because you are subscribed to the Google Groups "golang-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to golang-dev+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

Search Discussions

  • Adonovan at Aug 30, 2013 at 5:04 pm
    Hello crawshaw@google.com (cc: golang-dev@googlegroups.com),

    Please take another look.


    https://codereview.appspot.com/13270045/

    --

    ---
    You received this message because you are subscribed to the Google Groups "golang-dev" group.
    To unsubscribe from this group and stop receiving emails from it, send an email to golang-dev+unsubscribe@googlegroups.com.
    For more options, visit https://groups.google.com/groups/opt_out.

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
groupgolang-dev @
categoriesgo
postedAug 30, '13 at 2:03a
activeAug 30, '13 at 5:04p
posts2
users1
websitegolang.org

1 user in discussion

Adonovan: 2 posts

People

Translate

site design / logo © 2022 Grokbase