Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(3106)

Issue 5637043: code review 5637043: all: avoid bytes.NewBuffer(nil) (Closed)

Can't Edit
Can't Publish+Mail
Start Review
Created:
12 years, 3 months ago by r
Modified:
12 years, 3 months ago
Reviewers:
CC:
golang-dev, bradfitz, r2
Visibility:
Public.

Description

all: avoid bytes.NewBuffer(nil) The practice encourages people to think this is the way to create a bytes.Buffer when new(bytes.Buffer) or just var buf bytes.Buffer work fine. (html/token.go was missing the point altogether.)

Patch Set 1 #

Patch Set 2 : diff -r abfe7166037c https://go.googlecode.com/hg/ #

Patch Set 3 : diff -r cace174e66ec https://go.googlecode.com/hg/ #

Unified diffs Side-by-side diffs Delta from patch set Stats (+37 lines, -39 lines) Patch
M src/pkg/bufio/bufio_test.go View 1 chunk +1 line, -1 line 0 comments Download
M src/pkg/compress/flate/deflate_test.go View 1 1 chunk +3 lines, -3 lines 0 comments Download
M src/pkg/compress/lzw/reader_test.go View 1 3 chunks +3 lines, -3 lines 0 comments Download
M src/pkg/compress/zlib/writer_test.go View 1 1 chunk +2 lines, -2 lines 0 comments Download
M src/pkg/encoding/asn1/marshal.go View 1 chunk +1 line, -1 line 0 comments Download
M src/pkg/encoding/gob/encoder_test.go View 1 2 chunks +2 lines, -3 lines 0 comments Download
M src/pkg/encoding/hex/hex.go View 1 1 chunk +2 lines, -2 lines 0 comments Download
M src/pkg/encoding/hex/hex_test.go View 1 1 chunk +2 lines, -2 lines 0 comments Download
M src/pkg/encoding/pem/pem.go View 1 1 chunk +2 lines, -2 lines 0 comments Download
M src/pkg/encoding/pem/pem_test.go View 2 chunks +2 lines, -2 lines 0 comments Download
M src/pkg/exp/html/escape.go View 1 1 chunk +2 lines, -2 lines 0 comments Download
M src/pkg/exp/html/parse_test.go View 1 1 chunk +2 lines, -2 lines 0 comments Download
M src/pkg/exp/html/token.go View 1 chunk +1 line, -2 lines 0 comments Download
M src/pkg/exp/html/token_test.go View 1 1 chunk +2 lines, -2 lines 0 comments Download
M src/pkg/html/escape.go View 1 2 1 chunk +2 lines, -2 lines 0 comments Download
M src/pkg/image/jpeg/writer_test.go View 1 1 chunk +3 lines, -3 lines 0 comments Download
M src/pkg/image/png/writer_test.go View 1 1 chunk +3 lines, -3 lines 0 comments Download
M src/pkg/old/template/template_test.go View 1 1 chunk +2 lines, -2 lines 0 comments Download

Messages

Total messages: 6
r
Hello golang-dev@googlegroups.com, I'd like you to review this change to https://go.googlecode.com/hg/
12 years, 3 months ago (2012-02-06 00:53:52 UTC) #1
bradfitz
LGTM I prefer "var buf bytes.Buffer", though. Same number of allocations currently, but I think ...
12 years, 3 months ago (2012-02-06 01:08:33 UTC) #2
r2
Yes, although then you need the ugly & sometimes. I'll play some more. -rob
12 years, 3 months ago (2012-02-06 01:33:34 UTC) #3
r
Hello golang-dev@googlegroups.com, bradfitz@golang.org, r@google.com (cc: golang-dev@googlegroups.com), Please take another look.
12 years, 3 months ago (2012-02-06 01:50:19 UTC) #4
bradfitz
LGTM On Sun, Feb 5, 2012 at 5:50 PM, <r@golang.org> wrote: > Hello golang-dev@googlegroups.com, bradfitz@golang.org, ...
12 years, 3 months ago (2012-02-06 02:06:20 UTC) #5
r
12 years, 3 months ago (2012-02-06 03:09:06 UTC) #6
*** Submitted as http://code.google.com/p/go/source/detail?r=5900a93988af ***

all: avoid bytes.NewBuffer(nil)
The practice encourages people to think this is the way to
create a bytes.Buffer when new(bytes.Buffer) or
just var buf bytes.Buffer work fine.
(html/token.go was missing the point altogether.)

R=golang-dev, bradfitz, r
CC=golang-dev
http://codereview.appspot.com/5637043
Sign in to reply to this message.

Powered by Google App Engine
RSS Feeds Recent Issues | This issue
This is Rietveld f62528b