From 96db05671ea5fc9b34e9a1efb21c9d2e90483e74 Mon Sep 17 00:00:00 2001 From: Greg Soltis Date: Wed, 10 May 2023 13:32:12 -0700 Subject: [PATCH] Drop go implementation of recursive copy (#4874) Co-authored-by: Greg Soltis --- ...cursive_copy_rust.go => recursive_copy.go} | 0 cli/internal/fs/recursive_copy_go.go | 38 ------------------- 2 files changed, 38 deletions(-) rename cli/internal/fs/{recursive_copy_rust.go => recursive_copy.go} (100%) delete mode 100644 cli/internal/fs/recursive_copy_go.go diff --git a/cli/internal/fs/recursive_copy_rust.go b/cli/internal/fs/recursive_copy.go similarity index 100% rename from cli/internal/fs/recursive_copy_rust.go rename to cli/internal/fs/recursive_copy.go diff --git a/cli/internal/fs/recursive_copy_go.go b/cli/internal/fs/recursive_copy_go.go deleted file mode 100644 index baa60d2a8387c..0000000000000 --- a/cli/internal/fs/recursive_copy_go.go +++ /dev/null @@ -1,38 +0,0 @@ -//go:build go || !rust -// +build go !rust - -package fs - -import ( - "os" - "path/filepath" - - "github.com/vercel/turbo/cli/internal/turbopath" -) - -// RecursiveCopy copies either a single file or a directory. -func RecursiveCopy(from turbopath.AbsoluteSystemPath, to turbopath.AbsoluteSystemPath) error { - // Verified all callers are passing in absolute paths for from (and to) - statedFrom := LstatCachedFile{Path: from} - fromType, err := statedFrom.GetType() - if err != nil { - return err - } - - if fromType.IsDir() { - return WalkMode(statedFrom.Path.ToStringDuringMigration(), func(name string, isDir bool, fileType os.FileMode) error { - dest := filepath.Join(to.ToStringDuringMigration(), name[len(statedFrom.Path.ToString()):]) - // name is absolute, (originates from godirwalk) - src := LstatCachedFile{Path: UnsafeToAbsoluteSystemPath(name), fileType: &fileType} - if isDir { - mode, err := src.GetMode() - if err != nil { - return err - } - return os.MkdirAll(dest, mode) - } - return CopyFile(&src, dest) - }) - } - return CopyFile(&statedFrom, to.ToStringDuringMigration()) -}