protobuf

module
v0.0.0-...-f3aaec4 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 12, 2017 License: BSD-3-Clause

README

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

Users

These projects use gogoprotobuf:

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

Mentioned

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
Installation

To install it, you must first have Go (at least version 1.6.3) installed (see http://golang.org/doc/install). Go 1.8.3 and 1.9 are continuously tested.

Next, install the standard protocol buffer implementation from https://github.com/google/protobuf. Most versions from 2.3.1 should not give any problems, but 2.6.1, 3.0.2 and 3.4.0 are continuously tested.

Speed

Install the protoc-gen-gofast binary

go get github.com/gogo/protobuf/protoc-gen-gofast

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 github.com/gogo/protobuf/proto
go get github.com/gogo/protobuf/{binary}
go get github.com/gogo/protobuf/gogoproto

These binaries allow you to use gogoprotobuf extensions. You can also use your own binary.

To generate the code, you also need to set the include path properly.

protoc -I=. -I=$GOPATH/src -I=$GOPATH/src/github.com/gogo/protobuf/protobuf --{binary}_out=. myproto.proto

Note that in the protoc command, {binary} does not contain the initial prefix of "protoc-gen".

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 github.com/gogo/protobuf/proto
go get github.com/gogo/protobuf/jsonpb
go get github.com/gogo/protobuf/protoc-gen-gogo
go get github.com/gogo/protobuf/gogoproto

GRPC

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

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

Directories

Path Synopsis
conformance implements the conformance test subprocess protocol as documented in conformance.proto.
conformance implements the conformance test subprocess protocol as documented in conformance.proto.
conformance_proto
Package conformance is a generated protocol buffer package.
Package conformance is a generated protocol buffer package.
Package gogoproto provides extensions for protocol buffers to achieve: - fast marshalling and unmarshalling.
Package gogoproto provides extensions for protocol buffers to achieve: - fast marshalling and unmarshalling.
Package jsonpb provides marshaling and unmarshaling between protocol buffers and JSON.
Package jsonpb provides marshaling and unmarshaling between protocol buffers and JSON.
jsonpb_test_proto
Package jsonpb is a generated protocol buffer package.
Package jsonpb is a generated protocol buffer package.
plugin
defaultcheck
The defaultcheck plugin is used to check whether nullable is not used incorrectly.
The defaultcheck plugin is used to check whether nullable is not used incorrectly.
description
The description (experimental) plugin generates a Description method for each message.
The description (experimental) plugin generates a Description method for each message.
embedcheck
The embedcheck plugin is used to check whether embed is not used incorrectly.
The embedcheck plugin is used to check whether embed is not used incorrectly.
enumstringer
The enumstringer (experimental) plugin generates a String method for each enum.
The enumstringer (experimental) plugin generates a String method for each enum.
equal
The equal plugin generates an Equal and a VerboseEqual method for each message.
The equal plugin generates an Equal and a VerboseEqual method for each message.
face
The face plugin generates a function will be generated which can convert a structure which satisfies an interface (face) to the specified structure.
The face plugin generates a function will be generated which can convert a structure which satisfies an interface (face) to the specified structure.
gostring
The gostring plugin generates a GoString method for each message.
The gostring plugin generates a GoString method for each message.
marshalto
The marshalto plugin generates a Marshal and MarshalTo method for each message.
The marshalto plugin generates a Marshal and MarshalTo method for each message.
oneofcheck
The oneofcheck plugin is used to check whether oneof is not used incorrectly.
The oneofcheck plugin is used to check whether oneof is not used incorrectly.
populate
The populate plugin generates a NewPopulated function.
The populate plugin generates a NewPopulated function.
size
The size plugin generates a Size or ProtoSize method for each message.
The size plugin generates a Size or ProtoSize method for each message.
stringer
The stringer plugin generates a String method for each message.
The stringer plugin generates a String method for each message.
testgen
The testgen plugin generates Test and Benchmark functions for each message.
The testgen plugin generates Test and Benchmark functions for each message.
union
The onlyone plugin generates code for the onlyone extension.
The onlyone plugin generates code for the onlyone extension.
unmarshal
The unmarshal plugin generates a Unmarshal method for each message.
The unmarshal plugin generates a Unmarshal method for each message.
Package proto converts data structures to and from the wire format of protocol buffers.
Package proto converts data structures to and from the wire format of protocol buffers.
proto3_proto
Package proto3_proto is a generated protocol buffer package.
Package proto3_proto is a generated protocol buffer package.
protoc-gen-gogo
descriptor
Package descriptor provides functions for obtaining protocol buffer descriptors for generated Go types.
Package descriptor provides functions for obtaining protocol buffer descriptors for generated Go types.
generator
The code generator for the plugin for the Google protocol buffer compiler.
The code generator for the plugin for the Google protocol buffer compiler.
grpc
Package grpc outputs gRPC service descriptions in Go code.
Package grpc outputs gRPC service descriptions in Go code.
plugin
Package plugin_go is a generated protocol buffer package.
Package plugin_go is a generated protocol buffer package.
Package test is a generated protocol buffer package.
Package test is a generated protocol buffer package.
asymetric-issue125
Package asym is a generated protocol buffer package.
Package asym is a generated protocol buffer package.
casttype/combos/both
Package casttype is a generated protocol buffer package.
Package casttype is a generated protocol buffer package.
casttype/combos/marshaler
Package casttype is a generated protocol buffer package.
Package casttype is a generated protocol buffer package.
casttype/combos/neither
Package casttype is a generated protocol buffer package.
Package casttype is a generated protocol buffer package.
casttype/combos/unmarshaler
Package casttype is a generated protocol buffer package.
Package casttype is a generated protocol buffer package.
castvalue
Package castvalue is a generated protocol buffer package.
Package castvalue is a generated protocol buffer package.
castvalue/combos/both
Package castvalue is a generated protocol buffer package.
Package castvalue is a generated protocol buffer package.
castvalue/combos/marshaler
Package castvalue is a generated protocol buffer package.
Package castvalue is a generated protocol buffer package.
castvalue/combos/unmarshaler
Package castvalue is a generated protocol buffer package.
Package castvalue is a generated protocol buffer package.
combos/both
Package test is a generated protocol buffer package.
Package test is a generated protocol buffer package.
combos/marshaler
Package test is a generated protocol buffer package.
Package test is a generated protocol buffer package.
combos/unmarshaler
Package test is a generated protocol buffer package.
Package test is a generated protocol buffer package.
custom
Package custom contains custom types for test and example purposes.
Package custom contains custom types for test and example purposes.
custom-dash-type
Package custom contains custom types for test and example purposes.
Package custom contains custom types for test and example purposes.
custombytesnonstruct
Package custombytesnonstruct is a generated protocol buffer package.
Package custombytesnonstruct is a generated protocol buffer package.
data
Package data is a generated protocol buffer package.
Package data is a generated protocol buffer package.
empty-issue70
Package empty is a generated protocol buffer package.
Package empty is a generated protocol buffer package.
enumcustomname
Package enumcustomname is a generated protocol buffer package.
Package enumcustomname is a generated protocol buffer package.
enumdecl
Package enumdecl is a generated protocol buffer package.
Package enumdecl is a generated protocol buffer package.
enumdecl_all
Package enumdeclall is a generated protocol buffer package.
Package enumdeclall is a generated protocol buffer package.
enumprefix
Package enumprefix is a generated protocol buffer package.
Package enumprefix is a generated protocol buffer package.
enumstringer
Package enumstringer is a generated protocol buffer package.
Package enumstringer is a generated protocol buffer package.
example
Package test is a generated protocol buffer package.
Package test is a generated protocol buffer package.
filedotname
Package filedotname is a generated protocol buffer package.
Package filedotname is a generated protocol buffer package.
fuzztests
Package fuzztests is a generated protocol buffer package.
Package fuzztests is a generated protocol buffer package.
group
Package group is a generated protocol buffer package.
Package group is a generated protocol buffer package.
importdedup
Package importdedup is a generated protocol buffer package.
Package importdedup is a generated protocol buffer package.
importdedup/subpkg
Package subpkg is a generated protocol buffer package.
Package subpkg is a generated protocol buffer package.
importduplicate
Package importduplicate is a generated protocol buffer package.
Package importduplicate is a generated protocol buffer package.
importduplicate/proto
Package proto is a generated protocol buffer package.
Package proto is a generated protocol buffer package.
importduplicate/sortkeys
Package sortkeys is a generated protocol buffer package.
Package sortkeys is a generated protocol buffer package.
indeximport-issue72
Package indeximport is a generated protocol buffer package.
Package indeximport is a generated protocol buffer package.
indeximport-issue72/index
Package index is a generated protocol buffer package.
Package index is a generated protocol buffer package.
int64support
Package int64support is a generated protocol buffer package.
Package int64support is a generated protocol buffer package.
issue260
Package issue260 is a generated protocol buffer package.
Package issue260 is a generated protocol buffer package.
issue261
Package issue261 is a generated protocol buffer package.
Package issue261 is a generated protocol buffer package.
issue262
Package timefail is a generated protocol buffer package.
Package timefail is a generated protocol buffer package.
issue312
Package issue312 is a generated protocol buffer package.
Package issue312 is a generated protocol buffer package.
issue312/events
Package events is a generated protocol buffer package.
Package events is a generated protocol buffer package.
issue322
Package test is a generated protocol buffer package.
Package test is a generated protocol buffer package.
issue330
Package issue330 is a generated protocol buffer package.
Package issue330 is a generated protocol buffer package.
issue34
Package issue34 is a generated protocol buffer package.
Package issue34 is a generated protocol buffer package.
issue42order
Package issue42 is a generated protocol buffer package.
Package issue42 is a generated protocol buffer package.
issue8
Package proto is a generated protocol buffer package.
Package proto is a generated protocol buffer package.
mapdefaults
Package mapdefaults is a generated protocol buffer package.
Package mapdefaults is a generated protocol buffer package.
mapdefaults/combos/both
Package mapdefaults is a generated protocol buffer package.
Package mapdefaults is a generated protocol buffer package.
mapdefaults/combos/marshaler
Package mapdefaults is a generated protocol buffer package.
Package mapdefaults is a generated protocol buffer package.
mapdefaults/combos/neither
Package mapdefaults is a generated protocol buffer package.
Package mapdefaults is a generated protocol buffer package.
mapdefaults/combos/unmarshaler
Package mapdefaults is a generated protocol buffer package.
Package mapdefaults is a generated protocol buffer package.
mapsproto2/combos/both
Package proto2_maps is a generated protocol buffer package.
Package proto2_maps is a generated protocol buffer package.
mapsproto2/combos/marshaler
Package proto2_maps is a generated protocol buffer package.
Package proto2_maps is a generated protocol buffer package.
mapsproto2/combos/neither
Package proto2_maps is a generated protocol buffer package.
Package proto2_maps is a generated protocol buffer package.
mapsproto2/combos/unmarshaler
Package proto2_maps is a generated protocol buffer package.
Package proto2_maps is a generated protocol buffer package.
moredefaults
Package moredefaults is a generated protocol buffer package.
Package moredefaults is a generated protocol buffer package.
nopackage
Package nopackage is a generated protocol buffer package.
Package nopackage is a generated protocol buffer package.
oneof/combos/both
Package one is a generated protocol buffer package.
Package one is a generated protocol buffer package.
oneof/combos/marshaler
Package one is a generated protocol buffer package.
Package one is a generated protocol buffer package.
oneof/combos/neither
Package one is a generated protocol buffer package.
Package one is a generated protocol buffer package.
oneof/combos/unmarshaler
Package one is a generated protocol buffer package.
Package one is a generated protocol buffer package.
oneof3/combos/both
Package one is a generated protocol buffer package.
Package one is a generated protocol buffer package.
oneof3/combos/marshaler
Package one is a generated protocol buffer package.
Package one is a generated protocol buffer package.
oneof3/combos/neither
Package one is a generated protocol buffer package.
Package one is a generated protocol buffer package.
oneof3/combos/unmarshaler
Package one is a generated protocol buffer package.
Package one is a generated protocol buffer package.
oneofembed
Package proto is a generated protocol buffer package.
Package proto is a generated protocol buffer package.
packed
Package packed is a generated protocol buffer package.
Package packed is a generated protocol buffer package.
proto3extension
Package proto3extension is a generated protocol buffer package.
Package proto3extension is a generated protocol buffer package.
protosize
Package protosize is a generated protocol buffer package.
Package protosize is a generated protocol buffer package.
required
Package required is a generated protocol buffer package.
Package required is a generated protocol buffer package.
sizeunderscore
Package sizeunderscore is a generated protocol buffer package.
Package sizeunderscore is a generated protocol buffer package.
stdtypes
Package stdtypes is a generated protocol buffer package.
Package stdtypes is a generated protocol buffer package.
tags
Package tags is a generated protocol buffer package.
Package tags is a generated protocol buffer package.
theproto3/combos/both
Package theproto3 is a generated protocol buffer package.
Package theproto3 is a generated protocol buffer package.
theproto3/combos/marshaler
Package theproto3 is a generated protocol buffer package.
Package theproto3 is a generated protocol buffer package.
theproto3/combos/neither
Package theproto3 is a generated protocol buffer package.
Package theproto3 is a generated protocol buffer package.
theproto3/combos/unmarshaler
Package theproto3 is a generated protocol buffer package.
Package theproto3 is a generated protocol buffer package.
typedecl
Package typedecl is a generated protocol buffer package.
Package typedecl is a generated protocol buffer package.
typedecl_all
Package typedeclall is a generated protocol buffer package.
Package typedeclall is a generated protocol buffer package.
typedeclimport
Package typedeclimport is a generated protocol buffer package.
Package typedeclimport is a generated protocol buffer package.
typedeclimport/subpkg
Package subpkg is a generated protocol buffer package.
Package subpkg is a generated protocol buffer package.
types/combos/both
Package types is a generated protocol buffer package.
Package types is a generated protocol buffer package.
types/combos/marshaler
Package types is a generated protocol buffer package.
Package types is a generated protocol buffer package.
types/combos/neither
Package types is a generated protocol buffer package.
Package types is a generated protocol buffer package.
types/combos/unmarshaler
Package types is a generated protocol buffer package.
Package types is a generated protocol buffer package.
unmarshalmerge
Package unmarshalmerge is a generated protocol buffer package.
Package unmarshalmerge is a generated protocol buffer package.
unrecognized
Package unrecognized is a generated protocol buffer package.
Package unrecognized is a generated protocol buffer package.
unrecognizedgroup
Package unrecognizedgroup is a generated protocol buffer package.
Package unrecognizedgroup is a generated protocol buffer package.
Package types is a generated protocol buffer package.
Package types is a generated protocol buffer package.
test/fast
Package vanity is a generated protocol buffer package.
Package vanity is a generated protocol buffer package.
test/faster
Package vanity is a generated protocol buffer package.
Package vanity is a generated protocol buffer package.
test/slick
Package vanity is a generated protocol buffer package.
Package vanity is a generated protocol buffer package.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL