From 4162082cba27a76628811b0fafd9eb637bd66407 Mon Sep 17 00:00:00 2001 From: Alan Donovan Date: Mon, 17 Nov 2014 12:58:28 -0500 Subject: [PATCH] x/tools/*: print program name, not "Error", when reporting command error messages. Such messages are more informative when the error occurs deep within a script. Also: add tool name to digraph's usage messages. LGTM=gri R=gri CC=golang-codereviews https://golang.org/cl/173380043 --- cmd/callgraph/main.go | 2 +- cmd/digraph/digraph.go | 18 +++++++++--------- cmd/eg/eg.go | 5 ++--- cmd/gorename/main.go | 4 ++-- cmd/ssadump/main.go | 2 +- refactor/rename/rename.go | 2 +- 6 files changed, 16 insertions(+), 17 deletions(-) diff --git a/cmd/callgraph/main.go b/cmd/callgraph/main.go index 57ad2dd7d3..0c381b9176 100644 --- a/cmd/callgraph/main.go +++ b/cmd/callgraph/main.go @@ -134,7 +134,7 @@ func init() { func main() { flag.Parse() if err := doCallgraph(&build.Default, *algoFlag, *formatFlag, *testFlag, flag.Args()); err != nil { - fmt.Fprintf(os.Stderr, "callgraph: %s.\n", err) + fmt.Fprintf(os.Stderr, "callgraph: %s\n", err) os.Exit(1) } } diff --git a/cmd/digraph/digraph.go b/cmd/digraph/digraph.go index 76d39ec063..89855a9026 100644 --- a/cmd/digraph/digraph.go +++ b/cmd/digraph/digraph.go @@ -98,7 +98,7 @@ func main() { } if err := digraph(args[0], args[1:]); err != nil { - fmt.Fprintf(os.Stderr, "Error: %s\n", err) + fmt.Fprintf(os.Stderr, "digraph: %s\n", err) os.Exit(1) } } @@ -265,7 +265,7 @@ func digraph(cmd string, args []string) error { switch cmd { case "nodes": if len(args) != 0 { - return fmt.Errorf("usage: nodes") + return fmt.Errorf("usage: digraph nodes") } nodes := make(nodeset) for label := range g { @@ -275,7 +275,7 @@ func digraph(cmd string, args []string) error { case "degree": if len(args) != 0 { - return fmt.Errorf("usage: degree") + return fmt.Errorf("usage: digraph degree") } nodes := make(nodeset) for label := range g { @@ -288,7 +288,7 @@ func digraph(cmd string, args []string) error { case "succs", "preds": if len(args) == 0 { - return fmt.Errorf("usage: %s