FAQ
http://codereview.appspot.com/6548047/diff/16001/src/pkg/bufio/bufio.go
File src/pkg/bufio/bufio.go (right):

http://codereview.appspot.com/6548047/diff/16001/src/pkg/bufio/bufio.go#newcode384
src/pkg/bufio/bufio.go:384: }
On 2012/09/25 11:08:38, rog wrote:
i wonder if it might be good to be robust in the case where the
underlying
writer returns n<len(data) but does not return an error. if that
happens here
and the writer implements WriteTo, we'll lose data in a
hard-to-diagnose way. a
check in writeTo would be sufficient.
Hmm, I don't know the correct solution here for writers that are buggy.
Do you know of any examples elsewhere in the stdlib that work around
something like this?

One possible solution would be to keep writing until everything is
written, an error is returned or no data is written.

Another one would be to return io.ErrShortWrite if n != (w-r).

Or I could just panic.

Interested to hear your thoughts on this, I'll update the existing CR
with your other feedback in the meantime.

http://codereview.appspot.com/6548047/

Search Discussions

  • Mchaten at Sep 26, 2012 at 5:58 am
    Hello dave@cheney.net, nigeltao@golang.org, rsc@golang.org,
    bradfitz@golang.org, rogpeppe@gmail.com (cc:
    golang-dev@googlegroups.com),

    Please take another look.


    http://codereview.appspot.com/6548047/
  • Rsc at Sep 26, 2012 at 6:43 pm
    looks fine to me. nigel or rog?


    http://codereview.appspot.com/6548047/

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
groupgolang-dev @
categoriesgo
postedSep 26, '12 at 5:52a
activeSep 26, '12 at 6:43p
posts3
users2
websitegolang.org

2 users in discussion

Mchaten: 2 posts Rsc: 1 post

People

Translate

site design / logo © 2022 Grokbase