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`)