diff --git a/cmd/kratos/internal/base/path.go b/cmd/kratos/internal/base/path.go index f0a505cec..7456ba67a 100644 --- a/cmd/kratos/internal/base/path.go +++ b/cmd/kratos/internal/base/path.go @@ -37,7 +37,6 @@ func kratosHomeWithDir(dir string) string { } func copyFile(src, dst string, replaces []string) error { - var err error srcinfo, err := os.Stat(src) if err != nil { return err @@ -58,19 +57,18 @@ func copyFile(src, dst string, replaces []string) error { } func copyDir(src, dst string, replaces, ignores []string) error { - var err error - var fds []os.DirEntry - var srcinfo os.FileInfo - - if srcinfo, err = os.Stat(src); err != nil { + srcinfo, err := os.Stat(src) + if err != nil { return err } - if err = os.MkdirAll(dst, srcinfo.Mode()); err != nil { + err = os.MkdirAll(dst, srcinfo.Mode()) + if err != nil { return err } - if fds, err = os.ReadDir(src); err != nil { + fds, err := os.ReadDir(src) + if err != nil { return err } for _, fd := range fds { diff --git a/cmd/kratos/internal/base/repo.go b/cmd/kratos/internal/base/repo.go index bdcb3f010..4ad241c89 100644 --- a/cmd/kratos/internal/base/repo.go +++ b/cmd/kratos/internal/base/repo.go @@ -68,7 +68,7 @@ func (r *Repo) Pull(ctx context.Context) error { cmd.Dir = r.Path() _, err := cmd.CombinedOutput() if err != nil { - return nil + return err } cmd = exec.CommandContext(ctx, "git", "pull") cmd.Dir = r.Path()