1
0
mirror of https://github.com/golang/go synced 2024-11-12 07:10:22 -07:00

cmd/go: simplify code, reduce allocations.

This is a trivial change to make use of an existing `nl` byte slice
containing a single '\n' character. It's already declared and
used in another place in this file, so it might as well be used
in the other location instead of
a new slice literal. There should be no change in behavior,
aside from potentially less allocations.

This is my first CL, so I wanted to use a simple, hopefully non-controversial,
minor improvement to get more comfortable with golang contribution process.

LGTM=bradfitz
R=golang-codereviews, bradfitz
CC=golang-codereviews
https://golang.org/cl/97280043
This commit is contained in:
Dmitri Shuralyov 2014-05-10 18:06:58 -07:00 committed by Brad Fitzpatrick
parent d6a1fb0b0c
commit 4118665775

View File

@ -161,7 +161,7 @@ func runList(cmd *Command, args []string) {
fatalf("%s", err)
}
if out.NeedNL() {
out.Write([]byte{'\n'})
out.Write(nl)
}
}
}