Deduplicate dumper closing logic

This commit is contained in:
DRON-666 2020-12-19 02:42:46 +03:00
parent e136dd8696
commit 83b10dbb12
3 changed files with 10 additions and 13 deletions

View file

@ -23,13 +23,10 @@ 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)}
err := writeDump(ctx, repo, tree, rootPath, dmp, dst)
if err != nil {
dmp.w.Close()
return err
}
return writeDump(ctx, repo, tree, rootPath, dmp, dst)
}
func (dmp tarDumper) Close() error {
return dmp.w.Close()
}