diff --git a/cmd/oracle/main.go b/cmd/oracle/main.go index cdf5329c..f9e895a3 100644 --- a/cmd/oracle/main.go +++ b/cmd/oracle/main.go @@ -60,9 +60,10 @@ The mode argument determines the query to perform: callstack show path from callgraph root to selected function describe describe selected syntax: definition, methods, etc freevars show free variables of selection - implements show 'implements' relation for selected package + implements show 'implements' relation for selected type peers show send/receive corresponding to selected channel op referrers show all refs to entity denoted by selected identifier + what show basic information about the selected syntax node The user manual is available here: http://golang.org/s/oracle-user-manual @@ -111,7 +112,7 @@ func main() { args := flag.Args() if len(args) == 0 || args[0] == "" { - fmt.Fprint(os.Stderr, "Error: a mode argument is required.\n"+useHelp) + fmt.Fprint(os.Stderr, "oracle: a mode argument is required.\n"+useHelp) os.Exit(2) } @@ -123,7 +124,7 @@ func main() { } if len(args) == 0 && mode != "what" { - fmt.Fprint(os.Stderr, "Error: no package arguments.\n"+useHelp) + fmt.Fprint(os.Stderr, "oracle: no package arguments.\n"+useHelp) os.Exit(2) } @@ -157,14 +158,14 @@ func main() { case "json", "plain", "xml": // ok default: - fmt.Fprintf(os.Stderr, "Error: illegal -format value: %q.\n"+useHelp, *formatFlag) + fmt.Fprintf(os.Stderr, "oracle: illegal -format value: %q.\n"+useHelp, *formatFlag) os.Exit(2) } // Ask the oracle. res, err := oracle.Query(args, mode, *posFlag, ptalog, &build.Default, *reflectFlag) if err != nil { - fmt.Fprintf(os.Stderr, "Error: %s.\n", err) + fmt.Fprintf(os.Stderr, "oracle: %s.\n", err) os.Exit(1) } @@ -173,7 +174,7 @@ func main() { case "json": b, err := json.MarshalIndent(res.Serial(), "", "\t") if err != nil { - fmt.Fprintf(os.Stderr, "JSON error: %s.\n", err) + fmt.Fprintf(os.Stderr, "oracle: JSON error: %s.\n", err) os.Exit(1) } os.Stdout.Write(b) @@ -181,7 +182,7 @@ func main() { case "xml": b, err := xml.MarshalIndent(res.Serial(), "", "\t") if err != nil { - fmt.Fprintf(os.Stderr, "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/oracle/TODO b/oracle/TODO index bbf05779..b9d4271f 100644 --- a/oracle/TODO +++ b/oracle/TODO @@ -15,8 +15,6 @@ tools, which should act as if they were saved. Fix: make the guessImportPath hack work with external _test.go files too. -Allow the analysis scope to include multiple test packages at once. - Include complete pos/end information Serial output. But beware that sometimes a single token (e.g. +) is more helpful than the pos/end of the containing expression (e.g. x \n + \n y). diff --git a/oracle/oracle_test.go b/oracle/oracle_test.go index 987defea..9c22a7d7 100644 --- a/oracle/oracle_test.go +++ b/oracle/oracle_test.go @@ -74,8 +74,8 @@ func parseQueries(t *testing.T, filename string) []*query { } // Parse the file once to discover the test queries. - var fset token.FileSet - f, err := parser.ParseFile(&fset, filename, filedata, parser.ParseComments) + fset := token.NewFileSet() + f, err := parser.ParseFile(fset, filename, filedata, parser.ParseComments) if err != nil { t.Fatal(err) }