FAQ

On 2012/11/21 03:34:43, bradfitz wrote:
But why is this comment up here? It should be after the b.Buffered() != 0
check, right?
Depends on how you look it. I view this comment as explaining the entire
if block, not just the != 0 block, but I can easily see the opposite.


https://codereview.appspot.com/6842078/diff/5001/src/pkg/bufio/bufio.go#newcode581
src/pkg/bufio/bufio.go:581: if err = b.Flush(); err1 != nil {
this is misleading. if you really want this behavior, you'd put "err =
b.Flush()" inside the if body, not in the initializer. the idiom is you check
the variable you declared in the condition, but here you don't. you
check err1
instead of err.
This is a bug that the tests are not catching. I'm adding tests for this
section now. Thank you for catching this.



https://codereview.appspot.com/6842078/diff/5001/src/pkg/bufio/bufio.go#newcode612
src/pkg/bufio/bufio.go:612: if err == io.EOF || err ==
io.ErrUnexpectedEOF {
why?
I touch on this earlier in the code, should I repeat the comment?




https://codereview.appspot.com/6842078/

Search Discussions

Discussion Posts

Previous

Follow ups

Related Discussions

Discussion Navigation
viewthread | post
posts ‹ prev | 6 of 11 | next ›
Discussion Overview
groupgolang-dev @
categoriesgo
postedNov 21, '12 at 1:42a
activeNov 26, '12 at 2:58a
posts11
users3
websitegolang.org

3 users in discussion

Mchaten: 6 posts Dave Cheney: 3 posts Bradfitz: 2 posts

People

Translate

site design / logo © 2022 Grokbase