# protoc-demo02 **Repository Path**: ake1205_admin_admin_admin/protoc-demo02 ## Basic Information - **Project Name**: protoc-demo02 - **Description**: grpc protoc-gen-go protoc-gen-go-grpc - **Primary Language**: Unknown - **License**: Apache-2.0 - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 0 - **Created**: 2024-11-11 - **Last Updated**: 2024-11-11 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README # 1.配置grpc开发环境 ```shell # 先安装依赖包 sudo apt-get install autoconf automake libtool curl make g++ unzip # 安装 protobuf # protobuf版本:https://github.com/protocolbuffers/protobuf/releases # 配置环境变量 # export PROTOC_HOME=/home/ke666/my_tools/protoc-28.3 # export PATH=$PROTOC_HOME/bin:$PATH # 安装 protoc-gen-go git clone https://github.com/golang/protobuf.git # cd到protobuf/protoc-gen-go/,执行go build 和go install 即可, # go install命令可以把刚build 好的依赖放到gopkg中,如果配置了go环境变量,那就可以直接用来生成.pb文件 # 安装 protoc-gen-go-grpc go get google.golang.org/grpc/cmd/protoc-gen-go-grpc go install google.golang.org/grpc/cmd/protoc-gen-go-grpc protoc --go_out=. --go-grpc_out=. proto/sum.proto # 控制台如何编译sum.proto # protoc --go_out=. --go-grpc_out=. ./sum.proto ``` # 2.参考地址 ```shell 快速掌握go-zero开发 https://juejin.cn/post/7390682536744386594 手把手教你使用grpc https://juejin.cn/post/7375386125814546470#heading-13 ```