2019-05-05 20:33:09 +08:00
|
|
|
package main
|
|
|
|
|
|
|
|
import (
|
|
|
|
"os/exec"
|
|
|
|
|
|
|
|
"github.com/urfave/cli"
|
|
|
|
)
|
|
|
|
|
|
|
|
const (
|
2019-06-21 10:18:33 +08:00
|
|
|
_getGRPCGen = "go get -u github.com/gogo/protobuf/protoc-gen-gofast"
|
2019-06-02 19:07:58 +08:00
|
|
|
_grpcProtoc = `protoc --proto_path=%s --proto_path=%s --proto_path=%s --gofast_out=plugins=grpc:.`
|
2019-05-05 20:33:09 +08:00
|
|
|
)
|
|
|
|
|
|
|
|
func installGRPCGen() error {
|
2019-05-30 17:29:58 +08:00
|
|
|
if _, err := exec.LookPath("protoc-gen-gofast"); err != nil {
|
2019-05-05 20:33:09 +08:00
|
|
|
if err := goget(_getGRPCGen); err != nil {
|
|
|
|
return err
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return nil
|
|
|
|
}
|
|
|
|
|
|
|
|
func genGRPC(ctx *cli.Context) error {
|
|
|
|
return generate(ctx, _grpcProtoc)
|
|
|
|
}
|