protoc is a compiler for protocol buffers definitions files. It can can generate C++, Java and Python source code for the classes defined in PROTO_FILE.
安装protoc
tempdir=`mktemp -d /tmp/tmpd.XXXXXX`
fastgit=https://github.91chifun.workers.dev/https://github.com
version=protoc-3.10.0-linux-x86_64
wget -P $tempdir/protoc $fastgit/protocolbuffers/protobuf/releases/download/v3.10.0/$version.zip
unzip $tempdir/protoc/protoc-3.10.0-linux-x86_64.zip -d $tempdir/protoc/$version
cp $tempdir/protoc/protoc-3.10.0-linux-x86_64/bin/protoc $GOPATH/bin/
- protoc-gen-go
A plugin for the Google protocol buffer compiler to generate Go code. - protoc-gen-doc
This is a documentation generator plugin for the Google Protocol Buffers compiler (protoc).The plugin can generate HTML, JSON, DocBook and Markdown documentation from comments in your .proto files. - protoc-gen-micro This is protobuf code generation for micro. We use protoc-gen-micro to reduce boilerplate code.
安装golang版本的protobuf以及micro插件
go install github.com/micro/micro/v2@v2.9.3
go install github.com/golang/protobuf/protoc-gen-go@v1.3.2
go install github.com/pseudomuto/protoc-gen-doc/cmd/protoc-gen-doc@v1.5.0
go install github.com/micro/micro/v2/cmd/protoc-gen-micro@v2.9.3
验证环境
$ protoc --version
libprotoc 3.10.0