Procházet zdrojové kódy

Correctly close generated benchmark archives

Another update to TarSum tests, this patch fixes an issue where
the benchmarks were generating archives incorrectly by not closing
the tarWriter.

Docker-DCO-1.1-Signed-off-by: Josh Hawn <josh.hawn@docker.com> (github: jlhawn)
Josh Hawn před 10 roky
rodič
revize
385917e22c
1 změnil soubory, kde provedl 1 přidání a 0 odebrání
  1. 1 0
      pkg/tarsum/tarsum_test.go

+ 1 - 0
pkg/tarsum/tarsum_test.go

@@ -132,6 +132,7 @@ func sizedTar(opts sizedOptions) io.Reader {
 		fh = bytes.NewBuffer([]byte{})
 	}
 	tarW := tar.NewWriter(fh)
+	defer tarW.Close()
 	for i := int64(0); i < opts.num; i++ {
 		err := tarW.WriteHeader(&tar.Header{
 			Name: fmt.Sprintf("/testdata%d", i),