1
0
mirror of https://github.com/go-kratos/kratos.git synced 2025-02-03 13:11:42 +02:00
Tony e5fe1e4f63 Kratos protobuf protoc (#71)
* add cross-platform protoc
* add protobuf generator
2019-05-05 20:33:09 +08:00

26 lines
497 B
Go

package main
import (
"os/exec"
"github.com/urfave/cli"
)
const (
_getGRPCGen = "go get github.com/gogo/protobuf/protoc-gen-gogofast"
_grpcProtoc = "protoc --proto_path=%s --proto_path=%s --proto_path=%s --gogofast_out=plugins=grpc:."
)
func installGRPCGen() error {
if _, err := exec.LookPath("protoc-gen-gogofast"); err != nil {
if err := goget(_getGRPCGen); err != nil {
return err
}
}
return nil
}
func genGRPC(ctx *cli.Context) error {
return generate(ctx, _grpcProtoc)
}