From 492248d0320b4f95584d461dcea381a0d64c1412 Mon Sep 17 00:00:00 2001 From: jessetang <1430482733@qq.com> Date: Thu, 16 Mar 2023 11:32:44 +0800 Subject: [PATCH] fix(cmd): import format (#2735) --- cmd/kratos/internal/project/new.go | 6 +++--- cmd/kratos/internal/proto/client/client.go | 4 ++-- cmd/kratos/internal/proto/proto.go | 4 ++-- cmd/kratos/internal/upgrade/upgrade.go | 4 ++-- cmd/kratos/main.go | 4 ++-- 5 files changed, 11 insertions(+), 11 deletions(-) diff --git a/cmd/kratos/internal/project/new.go b/cmd/kratos/internal/project/new.go index f98552b01..c084e7f0e 100644 --- a/cmd/kratos/internal/project/new.go +++ b/cmd/kratos/internal/project/new.go @@ -6,10 +6,10 @@ import ( "os" "path" - "github.com/go-kratos/kratos/cmd/kratos/v2/internal/base" - "github.com/AlecAivazis/survey/v2" "github.com/fatih/color" + + "github.com/go-kratos/kratos/cmd/kratos/v2/internal/base" ) // Project is a project template. @@ -23,11 +23,11 @@ func (p *Project) New(ctx context.Context, dir string, layout string, branch str to := path.Join(dir, p.Name) if _, err := os.Stat(to); !os.IsNotExist(err) { fmt.Printf("🚫 %s already exists\n", p.Name) - override := false prompt := &survey.Confirm{ Message: "📂 Do you want to override the folder ?", Help: "Delete the existing folder and create the project.", } + var override bool e := survey.AskOne(prompt, &override) if e != nil { return e diff --git a/cmd/kratos/internal/proto/client/client.go b/cmd/kratos/internal/proto/client/client.go index 8bc006336..013f9f72a 100644 --- a/cmd/kratos/internal/proto/client/client.go +++ b/cmd/kratos/internal/proto/client/client.go @@ -8,9 +8,9 @@ import ( "regexp" "strings" - "github.com/go-kratos/kratos/cmd/kratos/v2/internal/base" - "github.com/spf13/cobra" + + "github.com/go-kratos/kratos/cmd/kratos/v2/internal/base" ) // CmdClient represents the source command. diff --git a/cmd/kratos/internal/proto/proto.go b/cmd/kratos/internal/proto/proto.go index 4b9c858b9..b176d5dec 100644 --- a/cmd/kratos/internal/proto/proto.go +++ b/cmd/kratos/internal/proto/proto.go @@ -1,11 +1,11 @@ package proto import ( + "github.com/spf13/cobra" + "github.com/go-kratos/kratos/cmd/kratos/v2/internal/proto/add" "github.com/go-kratos/kratos/cmd/kratos/v2/internal/proto/client" "github.com/go-kratos/kratos/cmd/kratos/v2/internal/proto/server" - - "github.com/spf13/cobra" ) // CmdProto represents the proto command. diff --git a/cmd/kratos/internal/upgrade/upgrade.go b/cmd/kratos/internal/upgrade/upgrade.go index a8825dcc1..79e53e3cf 100644 --- a/cmd/kratos/internal/upgrade/upgrade.go +++ b/cmd/kratos/internal/upgrade/upgrade.go @@ -3,9 +3,9 @@ package upgrade import ( "fmt" - "github.com/go-kratos/kratos/cmd/kratos/v2/internal/base" - "github.com/spf13/cobra" + + "github.com/go-kratos/kratos/cmd/kratos/v2/internal/base" ) // CmdUpgrade represents the upgrade command. diff --git a/cmd/kratos/main.go b/cmd/kratos/main.go index 2ae05e31a..a227a215d 100644 --- a/cmd/kratos/main.go +++ b/cmd/kratos/main.go @@ -3,13 +3,13 @@ package main import ( "log" + "github.com/spf13/cobra" + "github.com/go-kratos/kratos/cmd/kratos/v2/internal/change" "github.com/go-kratos/kratos/cmd/kratos/v2/internal/project" "github.com/go-kratos/kratos/cmd/kratos/v2/internal/proto" "github.com/go-kratos/kratos/cmd/kratos/v2/internal/run" "github.com/go-kratos/kratos/cmd/kratos/v2/internal/upgrade" - - "github.com/spf13/cobra" ) var rootCmd = &cobra.Command{