fix new mod name

fix/windows_path
haiyux 2 years ago
parent 6c646ecdcb
commit a657605ef5
  1. 3
      cmd/kratos/internal/project/new.go
  2. 2
      cmd/kratos/internal/project/project.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(

@ -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 {

Loading…
Cancel
Save