From a657605ef59b39fc223db2faa0ce15c529d9a978 Mon Sep 17 00:00:00 2001 From: haiyux <99347745@qq.com> Date: Fri, 26 May 2023 23:01:16 +0800 Subject: [PATCH] fix new mod name --- cmd/kratos/internal/project/new.go | 3 ++- cmd/kratos/internal/project/project.go | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/cmd/kratos/internal/project/new.go b/cmd/kratos/internal/project/new.go index 73c01986c..b6318959c 100644 --- a/cmd/kratos/internal/project/new.go +++ b/cmd/kratos/internal/project/new.go @@ -16,6 +16,7 @@ import ( type Project struct { Name string Path string + Mod string } // New new a project from remote repo. @@ -39,7 +40,7 @@ func (p *Project) New(ctx context.Context, dir string, layout string, branch str } fmt.Printf("🚀 Creating service %s, layout repo is %s, please wait a moment.\n\n", p.Name, layout) repo := base.NewRepo(layout, branch) - if err := repo.CopyTo(ctx, to, p.Path, []string{".git", ".github"}); err != nil { + if err := repo.CopyTo(ctx, to, p.Mod, []string{".git", ".github"}); err != nil { return err } e := os.Rename( diff --git a/cmd/kratos/internal/project/project.go b/cmd/kratos/internal/project/project.go index 3e6eec1ee..a41ca4451 100644 --- a/cmd/kratos/internal/project/project.go +++ b/cmd/kratos/internal/project/project.go @@ -66,7 +66,7 @@ func run(_ *cobra.Command, args []string) { name = args[0] } projectName, workingDir := processProjectParams(name, wd) - p := &Project{Name: projectName, Path: projectName} + p := &Project{Name: projectName, Path: projectName, Mod: name} done := make(chan error, 1) go func() { if !nomod {