diff --git a/gzip.go b/gzip.go index 0b97b8c..961456b 100644 --- a/gzip.go +++ b/gzip.go @@ -46,18 +46,18 @@ func (c *Converter) csvToGzip(toGzip chan *csvBuf, w io.Writer, wg *sync.WaitGro return } - err = zw.Flush() - if err != nil { - c.quit <- fmt.Errorf("Error flushing contents to gzip writer: ", err) - return - } - if csvBuf.lastPart { err = zw.Close() if err != nil { c.quit <- fmt.Errorf("Error flushing contents to gzip writer: ", err) return } + } else { + err = zw.Flush() + if err != nil { + c.quit <- fmt.Errorf("Error flushing contents to gzip writer: ", err) + return + } } // Upload partially created file to S3