在线时间:8:00-16:00
迪恩网络APP
随时随地掌握行业动态
扫描二维码
关注迪恩网络微信公众号
开源软件名称:gogo/protobuf开源软件地址:https://github.com/gogo/protobuf开源编程语言:Go 93.1%开源软件介绍:GoGo Protobuf looking for new ownership Protocol Buffers for Go with Gadgetsgogoprotobuf is a fork of golang/protobuf with extra code generation features. This code generation is used to achieve:
Keeping track of how up to date gogoprotobuf is relative to golang/protobuf is done in this issue Release v1.3.0The project has updated to release v1.3.0. Check out the release notes here. With this new release comes a new internal library version. This means any newly generated *pb.go files generated with the v1.3.0 library will not be compatible with the old library version (v1.2.1). However, current *pb.go files (generated with v1.2.1) should still work with the new library. Please make sure you manage your dependencies correctly when upgrading your project. If you are still using v1.2.1 and you update your dependencies, one of which could include a new *pb.go (generated with v1.3.0), you could get a compile time error. Our upstream repo, golang/protobuf, also had to go through this process in order to update their library version. Here is a link explaining hermetic builds. UsersThese projects use gogoprotobuf:
Please let us know if you are using gogoprotobuf by posting on our GoogleGroup. Mentioned
Getting StartedThere are several ways to use gogoprotobuf, but for all you need to install go and protoc. After that you can choose:
InstallationTo install it, you must first have Go (at least version 1.6.3 or 1.9 if you are using gRPC) installed (see http://golang.org/doc/install). Latest patch versions of 1.12 and 1.15 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.14.0 are continuously tested. SpeedInstall the protoc-gen-gofast binary
Use it to generate faster marshaling and unmarshaling go code for your protocol buffers.
This does not allow you to use any of the other gogoprotobuf extensions. More Speed and more generated codeFields without pointers cause less time in the garbage collector. More code generation results in more convenient methods. Other binaries are also included:
Installing any of these binaries is easy. Simply run:
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.
To use proto files from "google/protobuf" you need to add additional args to protoc.
Note that in the protoc command, {binary} does not contain the initial prefix of "protoc-gen". Most Speed and most customizationCustomizing 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:
GRPCIt works the same as golang/protobuf, simply specify the plugin. Here is an example using gofast:
See https://github.com/gogo/grpc-example for an example of using gRPC with gogoprotobuf and the wider grpc-ecosystem. LicenseThis software is licensed under the 3-Clause BSD License ("BSD License 2.0", "Revised BSD License", "New BSD License", or "Modified BSD License"). |
2023-10-27
2022-08-15
2022-08-17
2022-09-23
2022-08-13
请发表评论