1
0
mirror of https://github.com/golang/go synced 2024-11-18 23:05:06 -07:00

go/analysis/singlechecker: use Stderr in flag.Usage

It was using a mix of stdout and stderr. Most users won't notice, but
it's inconsistent for no apparent reason. In particular, I noticed as
some of my tool execution tests started failing.

Change-Id: I9afe5f5bed0a575d3ba20e8dc1cc593c35565cf9
Reviewed-on: https://go-review.googlesource.com/c/162717
Run-TryBot: Daniel Martí <mvdan@mvdan.cc>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Alan Donovan <adonovan@google.com>
This commit is contained in:
Daniel Martí 2019-02-14 16:06:32 +00:00
parent 508f945e1a
commit c161412db0

View File

@ -52,11 +52,11 @@ func Main(a *analysis.Analyzer) {
flag.Usage = func() { flag.Usage = func() {
paras := strings.Split(a.Doc, "\n\n") paras := strings.Split(a.Doc, "\n\n")
fmt.Fprintf(os.Stderr, "%s: %s\n\n", a.Name, paras[0]) fmt.Fprintf(os.Stderr, "%s: %s\n\n", a.Name, paras[0])
fmt.Printf("Usage: %s [-flag] [package]\n\n", a.Name) fmt.Fprintf(os.Stderr, "Usage: %s [-flag] [package]\n\n", a.Name)
if len(paras) > 1 { if len(paras) > 1 {
fmt.Println(strings.Join(paras[1:], "\n\n")) fmt.Fprintln(os.Stderr, strings.Join(paras[1:], "\n\n"))
} }
fmt.Println("\nFlags:") fmt.Fprintf(os.Stderr, "\nFlags:")
flag.PrintDefaults() flag.PrintDefaults()
} }