谷歌插件protoc-gen-doc实现 proto转文档详细解坑
背景
出于工作需求要求自己开发接口协议。为了尽快熟悉proto协议使用谷歌插件proto-gen-doc将proto转文档查看。(不得不说,确实方便,大大便捷了开发人员和非开发之间交流)
安装步骤
环境
protoc3.11.0 golang go1.12.10 ubuntu16
protobuf安装
https://github.com/google/protobuf
chmod 777 -R protobuf
cd protobuf
./autogen
./configure
make
make install
ldconfig
顺利完成(如果不幸make途中任何地方出现问题,一定要make clean清除干净之后重新进行)
protoc --version查看版本
protoc-gen-doc插件安装
https://github.com/pseudomuto/protoc-gen-doc
go get 获取项目安装
go get github.com/pseudomuto/proto-gen-doc/cmd/protoc-gen-doc
默认自动gopath下自动生成 protoc-gen-doc可执行文件免去编译过程
将可执行文件复制到path bin
protoc --plugin=protoc-gen-doc=./proto-gen-doc --doc_o