Merge pull request #3663 from nspcc-dev/io-improve-bytes-doc

io: specify Bytes() behavior a bit better for BufBinWriter
This commit is contained in:
Anna Shaleva 2024-11-06 11:15:52 +03:00 committed by GitHub
commit 1a540d5883
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -29,6 +29,8 @@ func (bw *BufBinWriter) Len() int {
} }
// Bytes returns the resulting buffer and makes future writes return an error. // 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 { func (bw *BufBinWriter) Bytes() []byte {
if bw.Err != nil { if bw.Err != nil {
return nil return nil