You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
iflen(b)%2==1 { // data size must be aligned to an even byte
n2, _:=aw.w.Write([]byte{'\n'})
returnn+n2, err
}
essentially closes the file after each call to Write, which means you can't use the API to write a file one piece at a time (e.g. with io.Copy, or dumping out from a stream),
It should only write that footer when aw.nb == 0.
In my opinion, the best way to handle this would be to follow the example of archive/tar and don't write the file footer until either the next call to WriteHeader() or Close(). Of course that would require introduction of a Close method, which would be a breaking API change.
The text was updated successfully, but these errors were encountered:
This is really a superset of #4.
Currently,
ar/writer.go
Lines 93 to 96 in 809d437
essentially closes the file after each call to
Write
, which means you can't use the API to write a file one piece at a time (e.g. withio.Copy
, or dumping out from a stream),It should only write that footer when
aw.nb == 0
.In my opinion, the best way to handle this would be to follow the example of
archive/tar
and don't write the file footer until either the next call toWriteHeader()
orClose()
. Of course that would require introduction of aClose
method, which would be a breaking API change.The text was updated successfully, but these errors were encountered: