From: Ian Lance Taylor Date: Sat, 20 Dec 2014 01:31:16 +0000 (-0800) Subject: testing: style change: omit unnecessary new X-Git-Tag: go1.5beta1~2584 X-Git-Url: http://www.git.cypherpunks.su/?a=commitdiff_plain;h=1e65616e1a03bfb71478a8dc43a4cd6e8c013107;p=gostls13.git 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 --- diff --git a/src/testing/example.go b/src/testing/example.go index f5762e4db4..61339a6465 100644 --- a/src/testing/example.go +++ b/src/testing/example.go @@ -56,8 +56,8 @@ func runExample(eg InternalExample) (ok bool) { os.Stdout = w outC := make(chan string) go func() { - buf := new(bytes.Buffer) - _, err := io.Copy(buf, r) + var buf bytes.Buffer + _, err := io.Copy(&buf, r) r.Close() if err != nil { fmt.Fprintf(os.Stderr, "testing: copying pipe: %v\n", err)