golang_protobuf环境搭建

                                                            搭建golang使用rotobuf使用环境

一 安装protobuf:

  1 下载protobuf源码:https://github.com/google/protobuf

      2 进入源码目录: ./autogen.sh    

           可能遇到问题:1 该脚本会下载gmock, 若被墙,则需翻墙下载并解压为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

原文地址:https://www.cnblogs.com/--xiaoyao--/p/5142567.html