diff --git a/cmd/gotype/gotype.go b/cmd/gotype/gotype.go index 7132ca9461..789d822371 100644 --- a/cmd/gotype/gotype.go +++ b/cmd/gotype/gotype.go @@ -196,10 +196,12 @@ func checkPkgFiles(files []*ast.File) { } defer func() { - switch err := recover().(type) { + switch p := recover().(type) { case nil, bailout: + // normal return or early exit default: - panic(err) + // re-panic + panic(p) } }() diff --git a/go/types/check.go b/go/types/check.go index 9bc7a4716c..39c5811d6d 100644 --- a/go/types/check.go +++ b/go/types/check.go @@ -7,7 +7,6 @@ package types import ( - "fmt" "go/ast" "go/token" "path" @@ -173,13 +172,8 @@ func (check *checker) handleBailout(err *error) { // normal return or early exit *err = check.firstErr default: - // unexpected panic: don't crash clients - // TODO(gri) add a test case for this scenario - *err = fmt.Errorf("types internal error: %v", p) - if debug { - check.dump("INTERNAL PANIC: %v", p) - panic(p) - } + // re-panic + panic(p) } }