From e4595db3d80cc4457d5c90f6a4ea32a630872817 Mon Sep 17 00:00:00 2001 From: 180909 Date: Thu, 23 Feb 2023 18:24:52 +0800 Subject: [PATCH] fix: cmd `proto add` nil pointer (#2670) --- cmd/kratos/internal/proto/add/add.go | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/cmd/kratos/internal/proto/add/add.go b/cmd/kratos/internal/proto/add/add.go index 88433dc75..e770dd5fb 100644 --- a/cmd/kratos/internal/proto/add/add.go +++ b/cmd/kratos/internal/proto/add/add.go @@ -20,7 +20,10 @@ var CmdAdd = &cobra.Command{ } func run(cmd *cobra.Command, args []string) { - // kratos proto add helloworld/v1/helloworld.proto + if len(args) == 0 { + fmt.Println("Please enter the proto file or directory") + return + } input := args[0] n := strings.LastIndex(input, "/") if n == -1 {