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 <adg@golang.org>
This commit is contained in:
Alan Donovan 2015-05-12 10:44:04 -04:00
parent 5df6d9290d
commit d1b42377f9
3 changed files with 5 additions and 5 deletions

View File

@ -176,7 +176,7 @@ func main() {
} }
if err := oracle.Run(&query); err != nil { 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) os.Exit(1)
} }
@ -185,7 +185,7 @@ func main() {
case "json": case "json":
b, err := json.MarshalIndent(query.Serial(), "", "\t") b, err := json.MarshalIndent(query.Serial(), "", "\t")
if err != nil { 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.Exit(1)
} }
os.Stdout.Write(b) os.Stdout.Write(b)
@ -193,7 +193,7 @@ func main() {
case "xml": case "xml":
b, err := xml.MarshalIndent(query.Serial(), "", "\t") b, err := xml.MarshalIndent(query.Serial(), "", "\t")
if err != nil { 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.Exit(1)
} }
os.Stdout.Write(b) os.Stdout.Write(b)

View File

@ -219,7 +219,7 @@ this channel receive/send operation."
"Enumerate all references to the object denoted by the selected "Enumerate all references to the object denoted by the selected
identifier." identifier."
(interactive) (interactive)
(go-oracle--run "referrers" t)) (go-oracle--run "referrers"))
(defun go-oracle-whicherrs () (defun go-oracle-whicherrs ()
"Show globals, constants and types to which the selected "Show globals, constants and types to which the selected

View File

@ -152,7 +152,7 @@ func guessImportPath(filename string, buildContext *build.Context) (srcdir, impo
} }
} }
if srcdir == "" { 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(), ", ")) filepath.Dir(absFile), strings.Join(buildContext.SrcDirs(), ", "))
} }
return return