aboutsummaryrefslogtreecommitdiff
path: root/src/testing/example.go
diff options
context:
space:
mode:
authorIan Lance Taylor <iant@golang.org>2014-12-19 17:31:16 -0800
committerIan Lance Taylor <iant@golang.org>2014-12-20 01:40:11 +0000
commit1e65616e1a03bfb71478a8dc43a4cd6e8c013107 (patch)
treeb33ebec7c4a58a0dc30449c6257cd887d2c80450 /src/testing/example.go
parent6ceb60444d7647fc62d692743ad98202c3669b8e (diff)
downloadgo-1e65616e1a03bfb71478a8dc43a4cd6e8c013107.tar.xz
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>
Diffstat (limited to 'src/testing/example.go')
-rw-r--r--src/testing/example.go4
1 files changed, 2 insertions, 2 deletions
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)