gogo protobuf
gogoprotobuf使用(上)
来自 <https://my.oschina.net/alexstocks/blog/387031>
gogoprotobuf使用(下)
来自 <https://studygolang.com/articles/2575>
./protoc --gogofast_out=plugins=grpc:../src/github.com/Gauss100_OLTP_DB/consistency/raft/raftpb/ -I../src/github.com/Gauss100_OLTP_DB/consistency/raft/raftpb/ -I ../ -I ../src/github.com/gogo/protobuf/protobuf/ ../src/github.com/Gauss100_OLTP_DB/consistency/raft/raftpb/raft.proto
protoc --gofast_out=. -I/root/Gauss100_OLTP_V1R5_PINETREE/src/github.com/gogo/protobuf/protobuf/ -I/root/Gauss100_OLTP_V1R5_PINETREE/src/ -I. raft.proto
Compiler Invocation
The protocol buffer compiler requires a plugin to generate Go code. Installing it with
$ go get github.com/golang/protobuf/protoc-gen-go
provides a protoc-gen-go binary which protoc uses when invoked with the --go_out command-line flag. The --go_out flag tells the compiler where to write the Go source files. The compiler creates a single source file for each .proto file input.
The names of the output files are computed by taking the name of the .proto file and making two changes:
• The extension (.proto) is replaced with .pb.go. For example, a file called player_record.proto results in an output file called player_record.pb.go.
• The proto path (specified with the --proto_path or -I command-line flag) is replaced with the output path (specified with the --go_out flag).
When you run the proto compiler like this:
protoc --proto_path=src --go_out=build/gen src/foo.proto src/bar/baz.proto
the compiler will read the files src/foo.proto and src/bar/baz.proto. It produces two output files:build/gen/foo.pb.go and build/gen/bar/baz.pb.go.
The compiler automatically creates the directory build/gen/bar if necessary, but it will not create build orbuild/gen; they must already exist.
来自 <https://developers.google.com/protocol-buffers/docs/reference/go-generated#repeated>
gogo protobuf相关推荐
- go protobuf v1败给了gogo protobuf,那v2呢?
近期的一个项目有对结构化数据进行序列化和反序列化的需求,该项目具有performance critical属性,因此我们在选择序列化库包时是要考虑包的性能的. github上有一个有关Go序列化方法性 ...
- github.com/gogo/protobu: invalid pseudo-version: revision is shorter than canonical
编译执行go mod tidy时,出现了这个错误,挺恶心的: xxx requires github.com/micro/go-plugins@v1.3.0 requires ...
- ProtoBuf 生成 Go 代码去掉 JSON tag omitempty
文章目录 1.背景 2.定义 proto 文件 3.安装 protoc 和 protoc-gen-go 4. 编译 proto 文件 5.自定义选项(Custom Options) 5.1 简介 5. ...
- win10下golang使用protobuf
1.安装protobuf库文件 go get github.com/golang/protobuf/proto(待验证) 2.安装protobuf的编译器protoc url: https://git ...
- Go protobuf
使用protobuf实现节点间通信.编码报文以提高传输效率 protobuf全程Protocol Buffers,是Google开发的一种数据描述语言. protobuf是一种轻便高效的结构化数据存储 ...
- gRPC的那些事 - streaming
gRPC是一个高性能.通用的开源RPC框架,其由Google主要面向移动应用开发并基于HTTP/2协议标准而设计,基于ProtoBuf(Protocol Buffers)序列化协议开发,且支持众多开发 ...
- 计算密集型服务 性能优化实战始末
背景 项目背景 worker 服务数据链路图 worker 服务消费上游数据(工作日高峰期产出速度达近 200 MB/s,节假日高峰期可达 300MB/s 以上),进行中间处理后,写入多个下游.在实践 ...
- mac golang grpc proto pb文件生成go文件.md
文章目录 1.简介 2.操作步骤 1. 安装基础的protoc工具 1. 下载 2. 添加protoc到PATH 3. 安装golang的支持 4. 使用 1. 普通编译 2. import的路径 参 ...
- Golang 使用Protocol Buffer 案例
目录 1. 前言 2. Protobuf 简介 2.1 Protobuf 优点 2.2 Protobuf 缺点 2.3 Protobuf Golang 安装使用 3. Protobuf 通讯案例 3. ...
- 这几个常用的 Go 官方库,性能居然还不如三方开源库
Go 语言官方库给我们一贯的印象是:强大.好用.但是,金无足赤,人无完人,在一些性能要求苛刻的场景例如 json 解析,某些官方库的表现不尽如人意. 本文介绍几个对标官方库的开源库,它们的性能远超前者 ...
最新文章
- 华为云家庭视频监控帮你一起守护家
- Dynamics Ax 2012 – AIF Import CSV File
- 神策学堂“训练营+特训营”,种子学员招募中,来一起出圈呀!
- 对一次ARP欺骗分析
- 机器学习之支持向量机SVM之python实现ROC曲线绘制(二分类和多分类)
- python走起之第十三话
- web前端性能优化方案
- OA选择首先要清晰概念
- 食品药品版本库存管理软件
- 《程序员修炼之道》读书笔记(4):注重实效的偏执(防卫策略)
- 微信这个设置你们关闭了吗?
- Math数学工具类在java中如何使用?
- 购物网站被p.egou.com强制恶意劫持
- python图色模拟脚本_python实现按键精灵找色点击功能教程,使用pywin32和Pillow库
- 为什么非全站升级HTTPS不可? 1
- 篇章结构类型、层次及分析模式研究
- Java多线程——线程同步
- matlab关系运算
- 蓝屏0x0000007B
- 表格设置合并行后的斑马纹样式