Skip to content

alexsaveliev/go-sourcegraph

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

go-sourcegraph Build Status

Sourcegraph API client library for Go.

Work in progress. If you want to use this, post an issue or contact us @srcgraph.

Development

Protocol buffers

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.

First-time installation of protobuf and other codegen tools

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 - version 3.0.0-alpha-2 or 3.0.0-alpha-3.
  • protoc-gen-gogo - commit 0d32fa3409f705a45020a232768fb9b121f377e9.

TODO: Make it work with latest, confirm if there are any issues.

  1. 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.

  2. Install gogo/protobuf.

    go get -u github.com/gogo/protobuf/...
    
  3. Install grpc:

    go get google.golang.org/grpc
    
  4. Install gen-mocks by running:

    go get -u sourcegraph.com/sourcegraph/gen-mocks
    
  5. Install gopathexec:

    go get -u sourcegraph.com/sourcegraph/gopathexec
    
  6. Install grpccache-gen:

    go get -u sourcegraph.com/sqs/grpccache/grpccache-gen
    

Regenerating Go code after changing sourcegraph.proto

  1. 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.

Releases

No releases published

Packages

No packages published

Languages

  • Go 72.5%
  • Protocol Buffer 27.5%