sourcegraph / srclib

srclib is a polyglot code analysis library, built for hackability. It consists of language analysis toolchains (currently for Go and Java, with Python, JavaScript, and Ruby in beta) with a common output format, and a CLI tool for running the analysis.
https://srclib.org
Other
942 stars 62 forks source link

Fix json.RawMessage issue with proto.{Marshal,Unmarshal}. #179

Closed dmitshur closed 9 years ago

dmitshur commented 9 years ago

Use (gogoproto.customtype) = "sourcegraph.com/sqs/pbtypes.RawMessage" instead of "encoding/json.RawTypes", since the latter does not implement proto.{Marshal,Unmarshal}.

This restores change done in #177 (temporarily reverted due to the issue that this PR fixes). /cc @beyang

Depends on sqs/pbtypes#1 being merged.

dmitshur commented 9 years ago

All tests pass locally:

srclib $ go test ./...
?       sourcegraph.com/sourcegraph/srclib  [no test files]
ok      sourcegraph.com/sourcegraph/srclib/ann  0.003s
?       sourcegraph.com/sourcegraph/srclib/buildstore   [no test files]
?       sourcegraph.com/sourcegraph/srclib/cli  [no test files]
?       sourcegraph.com/sourcegraph/srclib/cmd/srclib   [no test files]
ok      sourcegraph.com/sourcegraph/srclib/config   0.006s
?       sourcegraph.com/sourcegraph/srclib/dep  [no test files]
?       sourcegraph.com/sourcegraph/srclib/doc  [no test files]
ok      sourcegraph.com/sourcegraph/srclib/flagutil 0.004s
ok      sourcegraph.com/sourcegraph/srclib/graph    0.005s
ok      sourcegraph.com/sourcegraph/srclib/grapher  0.011s
ok      sourcegraph.com/sourcegraph/srclib/plan 0.008s
?       sourcegraph.com/sourcegraph/srclib/scan [no test files]
ok      sourcegraph.com/sourcegraph/srclib/store    0.977s
?       sourcegraph.com/sourcegraph/srclib/store/pb [no test files]
?       sourcegraph.com/sourcegraph/srclib/store/pb/mock    [no test files]
ok      sourcegraph.com/sourcegraph/srclib/store/pbio   0.019s
ok      sourcegraph.com/sourcegraph/srclib/store/phtable    0.072s
ok      sourcegraph.com/sourcegraph/srclib/toolchain    0.010s
ok      sourcegraph.com/sourcegraph/srclib/unit 0.008s
?       sourcegraph.com/sourcegraph/srclib/util [no test files]
srclib $ echo $?
0

This was not the case in #177. Unfortunately, I did not try back then since Travis tests failed, and I assumed they weren't expected to work on non-master branch.

dmitshur commented 9 years ago

https://github.com/sqs/pbtypes/pull/1 is not merged yet, this won't work until it is.

dmitshur commented 9 years ago

The json.RawMessage -> pbtypes.RawMessage change will require a few followup fixes, e.g., in srclib-go tests.

dmitshur commented 9 years ago

Maybe not right away, since srclib-go vendors an (much) older version of srclib at this time (a commit from Feb 5).