golang_protobuf环境搭建
--xiaoyao-- · · 3041 次点击 · · 开始浏览搭建golang使用rotobuf使用环境
一 安装protobuf:
1 下载protobuf源码:https://github.com/google/protobuf
2 进入源码目录: ./autogen.sh
可能遇到问题:1 该脚本会下载gmock, 若被墙,则需FQ下载并解压为gmock放在该源码目录下
2 脚本会执行autoreconf命令,若未安装此命令则手动安装(ubantu安装:sudo apt-get install autoconf automake libtool )
3 ./configure;make;make check; sudo make install
4 sudo ldconfig # refresh shared library cache
二 安装gogoprotobuf:
1 go get -u github.com/golang/protobuf
三 使用gogoprotobuf:
1 protoc --go_out=. myproto.proto
示例地址:https://godoc.org/github.com/golang/protobuf/proto
有疑问加站长微信联系(非本文作者)
入群交流(和以上内容无关):加入Go大咖交流群,或添加微信:liuxiaoyan-s 备注:入群;或加QQ群:692541889
关注微信- 请尽量让自己的回复能够对别人有帮助
- 支持 Markdown 格式, **粗体**、~~删除线~~、
`单行代码` - 支持 @ 本站用户;支持表情(输入 : 提示),见 Emoji cheat sheet
- 图片支持拖拽、截图粘贴等方式上传
收入到我管理的专栏 新建专栏
搭建golang使用rotobuf使用环境
一 安装protobuf:
1 下载protobuf源码:https://github.com/google/protobuf
2 进入源码目录: ./autogen.sh
可能遇到问题:1 该脚本会下载gmock, 若被墙,则需FQ下载并解压为gmock放在该源码目录下
2 脚本会执行autoreconf命令,若未安装此命令则手动安装(ubantu安装:sudo apt-get install autoconf automake libtool )
3 ./configure;make;make check; sudo make install
4 sudo ldconfig # refresh shared library cache
二 安装gogoprotobuf:
1 go get -u github.com/golang/protobuf
三 使用gogoprotobuf:
1 protoc --go_out=. myproto.proto