CreateGZipArchive creates a tar archive, compresses it with gzip and writes the files/directories associated with the `sourcePaths` to it. If a sourcePath directory ends with /*, then its contents are copied over, but not the directory itself
(archivePath string, sourcePaths ...string)
| 41 | // CreateGZipArchive creates a tar archive, compresses it with gzip and writes the files/directories associated with the `sourcePaths` to it. |
| 42 | // If a sourcePath directory ends with /*, then its contents are copied over, but not the directory itself |
| 43 | func CreateGZipArchive(archivePath string, sourcePaths ...string) errors.Error { |
| 44 | err := createArchive("tar", archivePath, sourcePaths...) |
| 45 | if err != nil { |
| 46 | return err |
| 47 | } |
| 48 | // now gzip it |
| 49 | err = toGzip(archivePath) |
| 50 | if err != nil { |
| 51 | return errors.Default.Wrap(err, "error compressing archive to gzip") |
| 52 | } |
| 53 | return nil |
| 54 | } |
| 55 | |
| 56 | func createArchive(archiveType string, archivePath string, sourcePaths ...string) errors.Error { |
| 57 | for _, sourcePath := range sourcePaths { |
nothing calls this directly
no test coverage detected