From bbb96f1e1f1c40ac5a2c2dc9ae2ff567d8c61ddb Mon Sep 17 00:00:00 2001 From: songzhibin97 <49082129+songzhibin97@users.noreply.github.com> Date: Sun, 22 May 2022 09:46:05 +0800 Subject: [PATCH] Update run.go (#2025) --- cmd/kratos/internal/run/run.go | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/cmd/kratos/internal/run/run.go b/cmd/kratos/internal/run/run.go index 556af54b4..a84d45ba5 100644 --- a/cmd/kratos/internal/run/run.go +++ b/cmd/kratos/internal/run/run.go @@ -38,14 +38,15 @@ func Run(cmd *cobra.Command, args []string) { fmt.Fprintf(os.Stderr, "\033[31mERROR: %s\033[m\n", err) return } - if len(cmdPath) == 0 { + switch len(cmdPath) { + case 0: fmt.Fprintf(os.Stderr, "\033[31mERROR: %s\033[m\n", "The cmd directory cannot be found in the current directory") return - } else if len(cmdPath) == 1 { + case 1: for _, v := range cmdPath { dir = v } - } else { + default: var cmdPaths []string for k := range cmdPath { cmdPaths = append(cmdPaths, k)