1
0
mirror of https://github.com/golang/go synced 2024-11-23 02:10:03 -07:00

cmd/go: buffer output for go usage

It did tons of write syscalls before:
    https://www.youtube.com/watch?v=t60fhjAqBdw

This is the worst offender. It's not worth fixing all the cases of two
consecutive prints.

Change-Id: I95860ef6a844d89b149528195182b191aad8731b
Reviewed-on: https://go-review.googlesource.com/2371
Reviewed-by: Rob Pike <r@golang.org>
This commit is contained in:
Brad Fitzpatrick 2015-01-06 09:15:13 -08:00
parent ea64e5785d
commit f5f69bba3b

View File

@ -5,6 +5,7 @@
package main
import (
"bufio"
"bytes"
"flag"
"fmt"
@ -236,7 +237,9 @@ func capitalize(s string) string {
}
func printUsage(w io.Writer) {
tmpl(w, usageTemplate, commands)
bw := bufio.NewWriter(w)
tmpl(bw, usageTemplate, commands)
bw.Flush()
}
func usage() {