mirror of
https://github.com/zeromicro/go-zero.git
synced 2025-02-03 00:38:40 +08:00
Mkdir if not exists (#1659)
Co-authored-by: anqiansong <anqiansong@bytedance.com>
This commit is contained in:
parent
17e0afeac0
commit
448029aa4b
@ -20,11 +20,6 @@ var (
|
|||||||
errMultiInput = errors.New("ZRPC: only one source is expected")
|
errMultiInput = errors.New("ZRPC: only one source is expected")
|
||||||
)
|
)
|
||||||
|
|
||||||
const (
|
|
||||||
optImport = "import"
|
|
||||||
optSourceRelative = "source_relative"
|
|
||||||
)
|
|
||||||
|
|
||||||
// ZRPC generates grpc code directly by protoc and generates
|
// ZRPC generates grpc code directly by protoc and generates
|
||||||
// zrpc code by goctl.
|
// zrpc code by goctl.
|
||||||
func ZRPC(c *cli.Context) error {
|
func ZRPC(c *cli.Context) error {
|
||||||
@ -61,7 +56,22 @@ func ZRPC(c *cli.Context) error {
|
|||||||
if len(zrpcOut) == 0 {
|
if len(zrpcOut) == 0 {
|
||||||
return errInvalidZrpcOutput
|
return errInvalidZrpcOutput
|
||||||
}
|
}
|
||||||
|
goOutAbs, err := filepath.Abs(goOut)
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
grpcOutAbs, err := filepath.Abs(grpcOut)
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
err = pathx.MkdirIfNotExist(goOutAbs)
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
err = pathx.MkdirIfNotExist(grpcOutAbs)
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
if len(remote) > 0 {
|
if len(remote) > 0 {
|
||||||
repo, _ := util.CloneIntoGitHome(remote, branch)
|
repo, _ := util.CloneIntoGitHome(remote, branch)
|
||||||
if len(repo) > 0 {
|
if len(repo) > 0 {
|
||||||
|
Loading…
Reference in New Issue
Block a user