贺伟 пре 7 година
родитељ
комит
e303551daa
1 измењених фајлова са 5 додато и 1 уклоњено
  1. 5 1
      writer.go

+ 5 - 1
writer.go

@@ -213,7 +213,11 @@ func (z *Writer) Flush() error {
 		return nil
 	}
 
-	return z.compressBlock(z.data[:z.idx])
+	if err := z.compressBlock(z.data[:z.idx]); err != nil {
+		return err
+	}
+	z.idx = 0
+	return nil
 }
 
 // Close closes the Writer, flushing any unwritten data to the underlying io.Writer, but does not close the underlying io.Writer.