1
0
Fork 0
mirror of https://github.com/restic/restic.git synced 2024-12-22 07:43:03 +00:00

Remove unused Writer arg to internal/dump.writeDump

This commit is contained in:
greatroar 2021-09-24 12:52:27 +02:00
parent 8b758c78a3
commit 4f33eca634
4 changed files with 5 additions and 7 deletions

View file

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

View file

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

View file

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

View file

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