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

http://codereview.appspot.com/6565056/diff/9001/src/pkg/bufio/bufio.go#newcode581
src/pkg/bufio/bufio.go:581: var n, m int64
You could delete some of these declarations if you name the return
variables.

http://codereview.appspot.com/6565056/diff/9001/src/pkg/bufio/bufio.go#newcode583
src/pkg/bufio/bufio.go:583: for m, rerr = b.readBuf(r); m > 0; m, rerr =
b.readBuf(r) {
I'd prefer to use a 0-part for loop instead of a 3-part one, and then
inline the readBuf method:

func (b *Writer) ReadFrom(r io.Reader) (n int64, err error) {
if err = b.Flush(); err != nil {
return 0, err
}
if w, ok := b.wr.(io.ReaderFrom); ok {
return w.ReadFrom(r)
}
var m int
for {
m, err = r.Read(b.buf[b.n:])
if m == 0 {
break
}
b.n += m
n += int64(m)
if err1 := b.Flush(); err1 != nil {
return n, err1
}
if err != nil {
break
}
}
if err == io.EOF {
err = nil
}
return n, err
}

http://codereview.appspot.com/6565056/diff/9001/src/pkg/bufio/bufio_test.go
File src/pkg/bufio/bufio_test.go (right):

http://codereview.appspot.com/6565056/diff/9001/src/pkg/bufio/bufio_test.go#newcode844
src/pkg/bufio/bufio_test.go:844: continue //Don't want to spit out a
large amount of errors below
I don't think that the comment is necessary.

http://codereview.appspot.com/6565056/diff/9001/src/pkg/bufio/bufio_test.go#newcode846
src/pkg/bufio/bufio_test.go:846: for i, val := range b.Bytes() {
I'd say
if got, want := b.String(), string(input); got != want {
t.Errorf(ws[%d], rs[%d]:\ngot %q\nwant %q\n", wi, ri, got, want)
}

http://codereview.appspot.com/6565056/

Search Discussions

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
groupgolang-dev @
categoriesgo
postedOct 4, '12 at 12:58p
activeOct 19, '12 at 2:02a
posts6
users2
websitegolang.org

2 users in discussion

Nigeltao: 4 posts Mchaten: 2 posts

People

Translate

site design / logo © 2022 Grokbase