官方参考文档:

  • go install google.golang.org/protobuf/cmd/protoc-gen-go 安装protobuf go 插件
  • https://developers.google.com/protocol-buffers/docs/reference/go-generated  protobuf 官方参考教程
  • https://developers.google.com/protocol-buffers/docs/gotutorial 

安装protobuf 工具:

SRE实战 互联网时代守护先锋,助力企业售后服务体系运筹帷幄!一键直达领取阿里云限量特价优惠。

比较简单,直接github下载,编译安装即可; 编译会安装到/usr/local/下;安装 protoc 工具;

安装protoc-gen-go 工具:现在工具改变位置了,所以从官方主页下载最新链接;

https://pkg.go.dev/mod/google.golang.org/protobuf 模块主页和说明

go get -u google.golang.org/protobuf 下载代码

http://doc.oschina.net/grpc?t=56831 grpc 官方文档中文版

https://github.com/grpc/grpc-go/tree/master/examples grpc-go 例子

国内可参考文档:

https://blog.csdn.net/weixin_42366378/article/details/105722792 protobuf 语法简介

https://geektutu.com/post/quick-go-protobuf.html 可参考

https://blog.csdn.net/weixin_44627989/article/details/106079336 可参考

测试代码链接:https://github.com/yaowenxu/Workplace/tree/master/understand-go/pb 

扫码关注我们
微信号:SRE实战
拒绝背锅 运筹帷幄