No Description

sunhui 447d700175 init 4 months ago
src 6dc93dbd60 init 4 months ago
.gitignore 6bfeb87170 init 4 months ago
README.md 447d700175 init 4 months ago
build.gradle 6bfeb87170 init 4 months ago
go-build.sh 6bfeb87170 init 4 months ago
java-build.sh 6bfeb87170 init 4 months ago

README.md

proto代码生成规范

工具安装

  1. 安装protoc,安装最新的版本

    https://github.com/protocolbuffers/protobuf/releases
    
  2. 安装go插件

    go get -u github.com/golang/protobuf/protoc-gen-go
    

proto文件存放

默认目录 /src/main/proto 根据自己的模块创建文件夹放入自己模块的.proto

构建命令

  • java

    ./java-build.sh
    
  • go

    ./go-build.sh ./src/main/proto/product/product.proto
    

构建文件默认路径

  • java

    build/generated/*/grpc
    build/generated/*/java
    
  • go

    go/rpc
    

包名修改

如果包名匹配不上,可以自己手动改.proto里面的配置再构建代码

option java_package = "com.finogeeks.swan.grpc.lib";
option go_package = "go/rpc;grpc";  //前面是构建后文件放置路径,后面是代码的package