Open ahimelman opened 1 year ago
The comment (and docs) to NewBufferedWriter state that "Users must call Close to guarantee all data has been forwarded to the underlying io.Writer": https://github.com/golang/snappy/blob/674baa8c7fc30da5df3074a459494a7e6b427dff/encode.go#L132
NewBufferedWriter
However, in looking at the Flush/Close implementations, and their usages in tests, it seems that users only need to call Flush, not Close, which would allow a caller to continue using the buffered writer.
Flush
Close
The comment (and docs) to
NewBufferedWriter
state that "Users must call Close to guarantee all data has been forwarded to the underlying io.Writer": https://github.com/golang/snappy/blob/674baa8c7fc30da5df3074a459494a7e6b427dff/encode.go#L132However, in looking at the Flush/Close implementations, and their usages in tests, it seems that users only need to call
Flush
, notClose
, which would allow a caller to continue using the buffered writer.