update:2022-06-27
# 一、安装 protoc
# linux:
apt install -y protobuf-compiler
protoc --version
# macos:
brew install protobuf
protoc --version
# 二、安装 protoc-gen-gofast
git clone https://github.com/cute-angelia/gogo-protobuf.git --depth 1
cd gogo-protobuf
cd protoc-gen-gofast && go install
cd ../protoc-gen-gogo && go install
工具(cute-angelia/mysql-protobuf)可以快速将 sql struct 生成 proto3
虽然有 protoc-gen-gorm 这个插件, 但是配置很烦,需要修改每个 proto 文件
之前也魔改过一个protobuf
这次选型 gogo ,也是项目需要, 这次打算接入斗鱼的 jupiter, jupiter 使用的是 gogo-protobuf
jupiter 里面 gorm 用法还很原始, 需要自己定义 model, 这里直接集成到工具里面
几行代码能搞定的事情,就不去花大力气(兼容grpc和gorm)写插件了