From 8bcc2cbdad398a0d0f430db9b75de5dab1f152e5 Mon Sep 17 00:00:00 2001 From: Rogee Date: Wed, 10 Sep 2025 14:41:58 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E6=9B=B4=E6=96=B0=E9=94=99=E8=AF=AF?= =?UTF-8?q?=E5=A4=84=E7=90=86=EF=BC=8C=E6=8F=90=E4=BE=9B=E6=9B=B4=E6=B8=85?= =?UTF-8?q?=E6=99=B0=E7=9A=84=E8=B7=AF=E5=BE=84=E9=94=99=E8=AF=AF=E4=BF=A1?= =?UTF-8?q?=E6=81=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- cmd/buf.go | 2 ++ cmd/gen_route.go | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/cmd/buf.go b/cmd/buf.go index e3cf3b3..1af4682 100644 --- a/cmd/buf.go +++ b/cmd/buf.go @@ -2,7 +2,9 @@ package cmd import ( "fmt" + "os" "os/exec" + "path/filepath" log "github.com/sirupsen/logrus" "github.com/spf13/cobra" diff --git a/cmd/gen_route.go b/cmd/gen_route.go index 653631e..319d959 100644 --- a/cmd/gen_route.go +++ b/cmd/gen_route.go @@ -56,7 +56,7 @@ func commandGenRouteE(cmd *cobra.Command, args []string) error { modulePath := filepath.Join(path, "app/http") if _, err := os.Stat(modulePath); os.IsNotExist(err) { - log.Fatal("modules dir not exist, ", modulePath) + return fmt.Errorf("routes directory not found: %s (set --path to your project root)", modulePath) } // controllerPattern := regexp.MustCompile(`controller(_?\w+)?\.go`)