fix(cmd/kratos/internal/base/repo.go): missing error (#2734)

* fix(cmd/kratos/internal/base): missing error

* fix
pull/2739/head
jessetang 2 years ago committed by GitHub
parent 492248d032
commit 6369db2e8e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 14
      cmd/kratos/internal/base/path.go
  2. 2
      cmd/kratos/internal/base/repo.go

@ -37,7 +37,6 @@ func kratosHomeWithDir(dir string) string {
} }
func copyFile(src, dst string, replaces []string) error { func copyFile(src, dst string, replaces []string) error {
var err error
srcinfo, err := os.Stat(src) srcinfo, err := os.Stat(src)
if err != nil { if err != nil {
return err return err
@ -58,19 +57,18 @@ func copyFile(src, dst string, replaces []string) error {
} }
func copyDir(src, dst string, replaces, ignores []string) error { func copyDir(src, dst string, replaces, ignores []string) error {
var err error srcinfo, err := os.Stat(src)
var fds []os.DirEntry if err != nil {
var srcinfo os.FileInfo
if srcinfo, err = os.Stat(src); err != nil {
return err return err
} }
if err = os.MkdirAll(dst, srcinfo.Mode()); err != nil { err = os.MkdirAll(dst, srcinfo.Mode())
if err != nil {
return err return err
} }
if fds, err = os.ReadDir(src); err != nil { fds, err := os.ReadDir(src)
if err != nil {
return err return err
} }
for _, fd := range fds { for _, fd := range fds {

@ -68,7 +68,7 @@ func (r *Repo) Pull(ctx context.Context) error {
cmd.Dir = r.Path() cmd.Dir = r.Path()
_, err := cmd.CombinedOutput() _, err := cmd.CombinedOutput()
if err != nil { if err != nil {
return nil return err
} }
cmd = exec.CommandContext(ctx, "git", "pull") cmd = exec.CommandContext(ctx, "git", "pull")
cmd.Dir = r.Path() cmd.Dir = r.Path()

Loading…
Cancel
Save