tree: eab56c6db7203dd2c9f8a40473588c47357c3ac1 [path history] [tgz]
  1. gogoproto/
  2. io/
  3. proto/
  4. protobuf/
  5. protoc-gen-gogo/
  6. sortkeys/
  7. types/

Protocol Buffers for Go with Gadgets

Build Status

gogoprotobuf is a fork of golang/protobuf with extra code generation features.

This code generation is used to achieve:

  • fast marshalling and unmarshalling
  • more canonical Go structures
  • goprotobuf compatibility
  • less typing by optionally generating extra helper code
  • peace of mind by optionally generating test and benchmark code
  • other serialization formats

Keeping track of how up to date gogoprotobuf is relative to golang/protobuf is done in this issue


These projects use gogoprotobuf:

  • etcd - blog - sample proto file
  • spacemonkey - blog
  • badoo - sample proto file
  • mesos-go - sample proto file
  • heka - the switch from golang/protobuf to gogo/protobuf when it was still on
  • cockroachdb - sample proto file
  • go-ipfs - sample proto file
  • rkive-go - sample proto file
  • dropbox
  • srclib - sample proto file
  • adyoulike
  • cloudfoundry - sample proto file
  • kubernetes - go2idl built on top of gogoprotobuf
  • dgraph - release notes - benchmarks
  • centrifugo - release notes - blog
  • docker swarmkit - sample proto file
  • - go-nats-streaming
  • tidb - Communication between tidb and tikv
  • protoactor-go - vanity command that also generates actors from service definitions

Please lets us know if you are using gogoprotobuf by posting on our GoogleGroup.


  • Cloudflare - go serialization talk - Albert Strasheim
  • gophercon
  • alecthomas' go serialization benchmarks

Getting Started

There are several ways to use gogoprotobuf, but for all you need to install go and protoc. After that you can choose:

  • Speed
  • More Speed and more generated code
  • Most Speed and most customization


To install it, you must first have Go (at least version 1.6.3) installed (see Go 1.7.1 and 1.8 is continuously tested.

Next, install the standard protocol buffer implementation from Most versions from 2.3.1 should not give any problems, but 2.6.1, 3.0.2 and 3.1.0 are continuously tested.


Install the protoc-gen-gofast binary

go get

Use it to generate faster marshaling and unmarshaling go code for your protocol buffers.

protoc --gofast_out=. myproto.proto

This does not allow you to use any of the other gogoprotobuf extensions.

More Speed and more generated code

Fields without pointers cause less time in the garbage collector. More code generation results in more convenient methods.

Other binaries are also included:

protoc-gen-gogofast (same as gofast, but imports gogoprotobuf)
protoc-gen-gogofaster (same as gogofast, without XXX_unrecognized, less pointer fields)
protoc-gen-gogoslick (same as gogofaster, but with generated string, gostring and equal methods)

Installing any of these binaries is easy. Simply run:

go get
go get{binary}
go get

These binaries allow you to using gogoprotobuf extensions.

Most Speed and most customization

Customizing the fields of the messages to be the fields that you actually want to use removes the need to copy between the structs you use and structs you use to serialize. gogoprotobuf also offers more serialization formats and generation of tests and even more methods.

Please visit the extensions page for more documentation.

Install protoc-gen-gogo:

go get
go get
go get
go get


It works the same as golang/protobuf, simply specify the plugin. Here is an example using gofast:

protoc --gofast_out=plugins=grpc:. my.proto