Sourcegraph API client library for Go.
Work in progress. If you want to use this, post an issue or contact us @srcgraph.
This repository uses the sourcegraph/sourcegraph.proto
protocol buffers definition file to generate Go structs as well as gRPC clients and servers for various service interfaces.
You need to install and run the protobuf compiler before you can regenerate Go code after you change the sourcegraph.proto
file.
If you run into errors while compiling protobufs, try again with these older versions that are known to work:
protoc
- version3.0.0-alpha-2
or3.0.0-alpha-3
.protoc-gen-gogo
- commit0d32fa3409f705a45020a232768fb9b121f377e9
.
TODO: Make it work with latest, confirm if there are any issues.
-
Install protoc, the protobuf compiler. Find more details in the protobuf README.
brew install --devel protobuf
or if you are trying a specific version, you can manually install by running:
git clone https://github.com/google/protobuf.git cd protobuf ./autogen.sh ./configure --enable-static && make && sudo make install
Then make sure the
protoc
binary is in your$PATH
. -
Install gogo/protobuf.
go get -u github.com/gogo/protobuf/...
-
Install grpc:
go get google.golang.org/grpc
-
Install gen-mocks by running:
go get -u sourcegraph.com/sourcegraph/gen-mocks
-
Install
gopathexec
:go get -u sourcegraph.com/sourcegraph/gopathexec
-
Install
grpccache-gen
:go get -u sourcegraph.com/sqs/grpccache/grpccache-gen
-
In
go-sourcegraph
(this repository), run:go generate ./...
You can ignore warnings about "No syntax specified for the proto file." These are caused by old protobuf definition files that don't explicitly specify the new proto3 syntax, but they are harmless.