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

26 lines
489 B
Go

package main
import (
"os/exec"
"github.com/urfave/cli"
)
const (
_getBMGen = "go get github.com/bilibili/kratos/tool/protobuf/protoc-gen-bm"
_bmProtoc = "protoc --proto_path=%s --proto_path=%s --proto_path=%s --bm_out=explicit_http=true:."
)
func installBMGen() error {
if _, err := exec.LookPath("protoc-gen-bm"); err != nil {
if err := goget(_getBMGen); err != nil {
return err
}
}
return nil
}
func genBM(ctx *cli.Context) error {
return generate(ctx, _bmProtoc)
}