protobuf-1安装

安装protoc
根据自己的服务器版本进行下载安装,下载地址 https://github.com/protocolbu...

$ uname -a Linux localhost.localdomain 3.10.0-229.el7.x86_64 #1 SMP Fri Mar 6 11:36:42 UTC 2015 x86_64 x86_64 x86_64 GNU/Linux$ wget wget https://github.com/protocolbuffers/protobuf/releases/download/v21.4/protoc-21.4-linux-x86_64.zip$ unzip -d protoc-21.4-linux-x86_64 protoc-21.4-linux-x86_64.zip$ cd protoc-21.4-linux-x86_64/bin/$ mv protoc /usr/local/bin// 查看是否安装成功 $ protoc --version libprotoc 3.21.4

安装protoc-gen-go
【protobuf-1安装】go语言中将.proto 转化为go代码
go get -u github.com/golang/protobuf/protoc-gen-go

测试代码
https://github.com/tim1116/go...

    推荐阅读