From 3ffafd6499f50ea71d1ad1a7ac554f4c4448ed6c Mon Sep 17 00:00:00 2001 From: n-peugnet Date: Fri, 15 Oct 2021 12:03:44 +0200 Subject: add copyright and license notice + remove dead code --- tar.go | 43 ------------------------------------------- 1 file changed, 43 deletions(-) delete mode 100644 tar.go (limited to 'tar.go') diff --git a/tar.go b/tar.go deleted file mode 100644 index 02b8957..0000000 --- a/tar.go +++ /dev/null @@ -1,43 +0,0 @@ -package main - -import ( - "archive/tar" - "io" - "os" - - "github.com/n-peugnet/dna-backup/logger" - "github.com/n-peugnet/dna-backup/repo" -) - -func streamFilesTar(files []repo.File, stream io.WriteCloser) { - tarStream := tar.NewWriter(stream) - for _, f := range files { - file, err := os.Open(f.Path) - if err != nil { - logger.Error(err) - continue - } - stat, err := file.Stat() - if err != nil { - logger.Errorf("getting stat of file '%s': %s", f.Path, err) - continue - } - hdr, err := tar.FileInfoHeader(stat, "") - if err != nil { - logger.Errorf("creating tar header for file '%s': %s", f.Path, err) - continue - } - if err := tarStream.WriteHeader(hdr); err != nil { - logger.Panicf("writing tar header to stream for file '%s': %s", f.Path, err) - } - if _, err := io.Copy(tarStream, file); err != nil { - logger.Panicf("writing file to stream '%s': %s", f.Path, err) - } - } - if err := tarStream.Close(); err != nil { - logger.Panic("closing tar stream:", err) - } - if err := stream.Close(); err != nil { - logger.Panic("closing stream:", err) - } -} -- cgit v1.2.3