mirror of
https://github.com/golang/go
synced 2024-11-14 08:50:22 -07:00
go/types: add -panic flag to gotype command for debugging
Setting -panic will cause gotype to panic with the first reported error, producing a stack trace for debugging. For #23914. Change-Id: I40c41cf10aa13d1dd9a099f727ef4201802de13a Reviewed-on: https://go-review.googlesource.com/96375 Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
This commit is contained in:
parent
6450c591c7
commit
70b09c7271
@ -53,6 +53,8 @@ Flags controlling additional output:
|
||||
print parse trace (forces -seq)
|
||||
-comments
|
||||
parse comments (ignored unless -ast or -trace is provided)
|
||||
-panic
|
||||
panic on first error
|
||||
|
||||
Examples:
|
||||
|
||||
@ -105,6 +107,7 @@ var (
|
||||
printAST = flag.Bool("ast", false, "print AST (forces -seq)")
|
||||
printTrace = flag.Bool("trace", false, "print parse trace (forces -seq)")
|
||||
parseComments = flag.Bool("comments", false, "parse comments (ignored unless -ast or -trace is provided)")
|
||||
panicOnError = flag.Bool("panic", false, "panic on first error")
|
||||
)
|
||||
|
||||
var (
|
||||
@ -164,6 +167,9 @@ func usage() {
|
||||
}
|
||||
|
||||
func report(err error) {
|
||||
if *panicOnError {
|
||||
panic(err)
|
||||
}
|
||||
scanner.PrintError(os.Stderr, err)
|
||||
if list, ok := err.(scanner.ErrorList); ok {
|
||||
errorCount += len(list)
|
||||
|
Loading…
Reference in New Issue
Block a user