1
0
mirror of https://github.com/golang/go synced 2024-11-26 23:41:37 -07:00

testing: style change: omit unnecessary new

This was brought to my attention because a user thought that because
the file was named "example.go" it served as an example of good coding
practice.  It's not an example, of course, but may as well use a more
idiomatic style anyhow.

Change-Id: I7aa720f603f09f7d597fb7536dbf46ef09144e28
Reviewed-on: https://go-review.googlesource.com/1902
Reviewed-by: Minux Ma <minux@golang.org>
This commit is contained in:
Ian Lance Taylor 2014-12-19 17:31:16 -08:00
parent 6ceb60444d
commit 1e65616e1a

View File

@ -56,8 +56,8 @@ func runExample(eg InternalExample) (ok bool) {
os.Stdout = w os.Stdout = w
outC := make(chan string) outC := make(chan string)
go func() { go func() {
buf := new(bytes.Buffer) var buf bytes.Buffer
_, err := io.Copy(buf, r) _, err := io.Copy(&buf, r)
r.Close() r.Close()
if err != nil { if err != nil {
fmt.Fprintf(os.Stderr, "testing: copying pipe: %v\n", err) fmt.Fprintf(os.Stderr, "testing: copying pipe: %v\n", err)