gogo protobuf


gogoprotobuf使用(上)
来自  


gogoprotobuf使用(下)
来自  




./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.


来自  

你可能感兴趣的:(go)