go.tools/oracle: restore edits lost in rev aa9b649bccd9 (botched merge)

R=crawshaw
TBR=crawshaw
CC=golang-dev
https://golang.org/cl/13604044
This commit is contained in:
Alan Donovan 2013-09-09 21:31:33 -04:00
parent 927e0f9da6
commit 5eb0d4d152
1 changed files with 6 additions and 5 deletions

View File

@ -25,6 +25,7 @@ import (
"runtime"
"runtime/pprof"
"code.google.com/p/go.tools/importer"
"code.google.com/p/go.tools/oracle"
)
@ -41,7 +42,7 @@ var ptalogFlag = flag.String("ptalog", "",
var formatFlag = flag.String("format", "plain", "Output format: 'plain' or 'json'.")
const usage = `Go source code oracle.
Usage: oracle [<flag> ...] [<arg> ...]
Usage: oracle [<flag> ...] <args> ...
Use -help flag to display options.
The -mode flag is required; the -pos flag is required in most modes.
@ -55,7 +56,7 @@ Describe the syntax at offset 532 in this file (an import spec):
Print the callgraph of the trivial web-server in JSON format:
% oracle -mode=callgraph -format=json src/pkg/net/http/triv.go
`
` + importer.InitialPackagesUsage
var cpuprofile = flag.String("cpuprofile", "", "write cpu profile to file")
@ -84,7 +85,7 @@ func main() {
var ptalog io.Writer
if *ptalogFlag != "" {
if f, err := os.Create(*ptalogFlag); err != nil {
log.Fatalf(err.Error())
log.Fatal(err)
} else {
buf := bufio.NewWriter(f)
ptalog = buf
@ -114,7 +115,7 @@ func main() {
// Ask the oracle.
res, err := oracle.Query(args, *modeFlag, *posFlag, ptalog, &build.Default)
if err != nil {
fmt.Fprintf(os.Stderr, "Error: %s\n", err)
fmt.Fprintf(os.Stderr, "%s\n", err)
os.Exit(1)
}
@ -123,7 +124,7 @@ func main() {
case "json":
b, err := json.Marshal(res)
if err != nil {
fmt.Fprintf(os.Stderr, "JSON error: %s\n", err.Error())
fmt.Fprintf(os.Stderr, "JSON error: %s\n", err)
os.Exit(1)
}
var buf bytes.Buffer