diff --git a/internal/dump/common.go b/internal/dump/common.go index eb02b1c2e..39172e930 100644 --- a/internal/dump/common.go +++ b/internal/dump/common.go @@ -16,11 +16,7 @@ type dumper interface { dumpNode(ctx context.Context, node *restic.Node, repo restic.Repository) error } -// WriteDump will write the contents of the given tree to the given destination. -// It will loop over all nodes in the tree and dump them recursively. -type WriteDump func(ctx context.Context, repo restic.Repository, tree *restic.Tree, rootPath string, dst io.Writer) error - -func writeDump(ctx context.Context, repo restic.Repository, tree *restic.Tree, rootPath string, dmp dumper, dst io.Writer) error { +func writeDump(ctx context.Context, repo restic.Repository, tree *restic.Tree, rootPath string, dmp dumper) error { for _, rootNode := range tree.Nodes { rootNode.Path = rootPath err := dumpTree(ctx, repo, rootNode, rootPath, dmp) diff --git a/internal/dump/common_test.go b/internal/dump/common_test.go index e15659701..f692007be 100644 --- a/internal/dump/common_test.go +++ b/internal/dump/common_test.go @@ -3,6 +3,7 @@ package dump import ( "bytes" "context" + "io" "testing" "github.com/restic/restic/internal/archiver" @@ -27,6 +28,7 @@ func prepareTempdirRepoSrc(t testing.TB, src archiver.TestDir) (tempdir string, } type CheckDump func(t *testing.T, testDir string, testDump *bytes.Buffer) error +type WriteDump func(ctx context.Context, repo restic.Repository, tree *restic.Tree, rootPath string, dst io.Writer) error func WriteTest(t *testing.T, wd WriteDump, cd CheckDump) { tests := []struct { diff --git a/internal/dump/tar.go b/internal/dump/tar.go index f9716d152..b9a9a4633 100644 --- a/internal/dump/tar.go +++ b/internal/dump/tar.go @@ -23,7 +23,7 @@ var _ dumper = tarDumper{} func WriteTar(ctx context.Context, repo restic.Repository, tree *restic.Tree, rootPath string, dst io.Writer) error { dmp := tarDumper{w: tar.NewWriter(dst)} - return writeDump(ctx, repo, tree, rootPath, dmp, dst) + return writeDump(ctx, repo, tree, rootPath, dmp) } func (dmp tarDumper) Close() error { diff --git a/internal/dump/zip.go b/internal/dump/zip.go index f1e779d8e..69bf0a876 100644 --- a/internal/dump/zip.go +++ b/internal/dump/zip.go @@ -21,7 +21,7 @@ var _ dumper = zipDumper{} func WriteZip(ctx context.Context, repo restic.Repository, tree *restic.Tree, rootPath string, dst io.Writer) error { dmp := zipDumper{w: zip.NewWriter(dst)} - return writeDump(ctx, repo, tree, rootPath, dmp, dst) + return writeDump(ctx, repo, tree, rootPath, dmp) } func (dmp zipDumper) Close() error {