Skip to content

Commit

Permalink
Mkdir if not exists (zeromicro#1659)
Browse files Browse the repository at this point in the history
Co-authored-by: anqiansong <anqiansong@bytedance.com>
  • Loading branch information
kesonan and anqiansong authored Mar 17, 2022
1 parent 17e0afe commit 448029a
Showing 1 changed file with 16 additions and 6 deletions.
22 changes: 16 additions & 6 deletions tools/goctl/rpc/cli/zrpc.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,6 @@ var (
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 code by goctl.
func ZRPC(c *cli.Context) error {
Expand Down Expand Up @@ -61,7 +56,22 @@ func ZRPC(c *cli.Context) error {
if len(zrpcOut) == 0 {
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 {
repo, _ := util.CloneIntoGitHome(remote, branch)
if len(repo) > 0 {
Expand Down

0 comments on commit 448029a

Please sign in to comment.