io: specify Bytes() behavior a bit better for BufBinWriter

It's not immediately obvious.

Signed-off-by: Roman Khimov <roman@nspcc.ru>
This commit is contained in:
Roman Khimov 2024-11-05 16:58:11 +03:00
parent cee296eb92
commit 23f9c5a43b

View file

@ -29,6 +29,8 @@ func (bw *BufBinWriter) Len() int {
}
// Bytes returns the resulting buffer and makes future writes return an error.
// Subsequent calls to it will return nil. You can reuse this instance of
// [BufBinWriter] after [BufBinWriter.Reset].
func (bw *BufBinWriter) Bytes() []byte {
if bw.Err != nil {
return nil