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> 
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值