1、下载最新版的golang安装程序
https://github.com/protocolbuffers/protobuf/releases
2、 解压,把GOPATH的路径添加到环境变量
覆盖 GOPATH目录下的bin 和 include,目录如下图:
3、安装 go get -u github.com/golang/protobuf/protoc-gen-go
4、扩展:如果需要 Grpc兼容HTTP协议文档自动生成网关还需要安装一下连个
go get -u github.com/grpc-ecosystem/grpc-gateway/protoc-gen-grpc-gateway
go get -u github.com/grpc-ecosystem/grpc-gateway/protoc-gen-swagger