From d1b42377f98cad7c8b8b2996c4ada87e7410b9fe Mon Sep 17 00:00:00 2001 From: Alan Donovan Date: Tue, 12 May 2015 10:44:04 -0400 Subject: [PATCH] cmd/oracle: improve error messages Also, in Emacs, make 'referrers' query not prompt for a scope. Change-Id: I5c0f034d4fa8b653311f1b7d8ff58b699d168b79 Reviewed-on: https://go-review.googlesource.com/9927 Reviewed-by: Andrew Gerrand --- cmd/oracle/main.go | 6 +++--- cmd/oracle/oracle.el | 2 +- oracle/what.go | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/cmd/oracle/main.go b/cmd/oracle/main.go index 079ba26b..a7a16618 100644 --- a/cmd/oracle/main.go +++ b/cmd/oracle/main.go @@ -176,7 +176,7 @@ func main() { } if err := oracle.Run(&query); err != nil { - fmt.Fprintf(os.Stderr, "oracle: %s.\n", err) + fmt.Fprintf(os.Stderr, "oracle: %s\n", err) os.Exit(1) } @@ -185,7 +185,7 @@ func main() { case "json": b, err := json.MarshalIndent(query.Serial(), "", "\t") if err != nil { - fmt.Fprintf(os.Stderr, "oracle: JSON error: %s.\n", err) + fmt.Fprintf(os.Stderr, "oracle: JSON error: %s\n", err) os.Exit(1) } os.Stdout.Write(b) @@ -193,7 +193,7 @@ func main() { case "xml": b, err := xml.MarshalIndent(query.Serial(), "", "\t") if err != nil { - fmt.Fprintf(os.Stderr, "oracle: XML error: %s.\n", err) + fmt.Fprintf(os.Stderr, "oracle: XML error: %s\n", err) os.Exit(1) } os.Stdout.Write(b) diff --git a/cmd/oracle/oracle.el b/cmd/oracle/oracle.el index 58c082a7..33c7409a 100644 --- a/cmd/oracle/oracle.el +++ b/cmd/oracle/oracle.el @@ -219,7 +219,7 @@ this channel receive/send operation." "Enumerate all references to the object denoted by the selected identifier." (interactive) - (go-oracle--run "referrers" t)) + (go-oracle--run "referrers")) (defun go-oracle-whicherrs () "Show globals, constants and types to which the selected diff --git a/oracle/what.go b/oracle/what.go index b4d70aad..5a5c0cfa 100644 --- a/oracle/what.go +++ b/oracle/what.go @@ -152,7 +152,7 @@ func guessImportPath(filename string, buildContext *build.Context) (srcdir, impo } } if srcdir == "" { - err = fmt.Errorf("directory %s is not beneath GOROOT or GOPATH: %s", + err = fmt.Errorf("directory %s is not beneath any of these GOROOT/GOPATH directories: %s", filepath.Dir(absFile), strings.Join(buildContext.SrcDirs(), ", ")) } return