]> Cypherpunks repositories - gostls13.git/commitdiff
cmd/go: buffer output for go usage
authorBrad Fitzpatrick <bradfitz@golang.org>
Tue, 6 Jan 2015 17:15:13 +0000 (09:15 -0800)
committerBrad Fitzpatrick <bradfitz@golang.org>
Tue, 6 Jan 2015 20:31:35 +0000 (20:31 +0000)
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>
src/cmd/go/main.go

index 9691f39c763ffbde59d213cb67a0f8f50deb1420..9bf227925bf7390517bd50a148ee8d5e27a8b849 100644 (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() {