Last active
August 29, 2015 14:27
-
-
Save aaronlehmann/2397d1184cdfa1ed12dd to your computer and use it in GitHub Desktop.
Inconsistent compressed output between tarsum and direct gzip Writer
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
import ( | |
"compress/gzip" | |
"io" | |
"os" | |
"github.com/docker/docker/pkg/tarsum" | |
) | |
func main() { | |
gzippedFile, err := os.Create("normal.gz") | |
if err != nil { | |
panic(err.Error()) | |
} | |
tarsumFile, err := os.Create("tarsum.gz") | |
if err != nil { | |
panic(err.Error()) | |
} | |
gzipWriter := gzip.NewWriter(gzippedFile) | |
if err != nil { | |
panic(err.Error()) | |
} | |
tarsumLayer, err := tarsum.NewTarSum(io.TeeReader(os.Stdin, gzipWriter), false, tarsum.Version0) | |
if err != nil { | |
panic(err.Error()) | |
} | |
_, err = io.Copy(tarsumFile, tarsumLayer) | |
if err != nil { | |
panic(err.Error()) | |
} | |
gzipWriter.Close() | |
gzippedFile.Close() | |
tarsumFile.Close() | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment