Commit 2355d18e authored by Robert Griesemer's avatar Robert Griesemer Committed by Russ Cox

gofix: add -debug flag for quicker diagnosis of internal errors

R=rsc, r
CC=golang-dev
https://golang.org/cl/5564055
parent ceb59b06
......@@ -36,6 +36,9 @@ var allowed, force map[string]bool
var doDiff = flag.Bool("diff", false, "display diffs instead of rewriting files")
// enable for debugging gofix failures
const debug = false // display incorrectly reformatted source and exit
func usage() {
fmt.Fprintf(os.Stderr, "usage: gofix [-diff] [-r fixname,...] [-force fixname,...] [path ...]\n")
flag.PrintDefaults()
......@@ -161,6 +164,11 @@ func processFile(filename string, useStdin bool) error {
}
newFile, err = parser.ParseFile(fset, filename, newSrc, parserMode)
if err != nil {
if debug {
fmt.Printf("%s", newSrc)
report(err)
os.Exit(exitCode)
}
return err
}
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment