Closed thecoldwine closed 2 weeks ago
Note that you can get the same effect using
csv.NewWriter(bufio.NewWriterSize(w, size))
Closing as irrelevant then, since the provided standard solution works well, thanks for the prompt feedback.
Proposal Details
Currently
encoding/csv
Writer is currently exposing only one constructor usingbufio.NewWriter
constructor. This hardcodes the buffer size to 4096 which sometimes is not enough and code panics if a single csv record is longer than this length (assuming we're flushing after every record).Proposal:
Add one more constructor that allows to control the buffer size, so single row can fit into the buffer: