go.tools/go/types: report test errors immediately in -list mode

This way, errors reported before a crash are visible.

R=adonovan, r
CC=golang-dev
https://golang.org/cl/10802044
This commit is contained in:
Robert Griesemer 2013-07-10 22:19:43 -07:00
parent 71e1c68445
commit 59f09dcb8c
1 changed files with 11 additions and 4 deletions

View File

@ -195,9 +195,20 @@ func checkFiles(t *testing.T, testfiles []string) {
pkgName = files[0].Name.Name
}
if *listErrors {
t.Errorf("--- %s:", pkgName)
for _, err := range errlist {
t.Error(err)
}
}
// typecheck and collect typechecker errors
var ctxt Context
ctxt.Error = func(err error) {
if *listErrors {
t.Error(err)
return
}
// Ignore error messages containing "previous declaration":
// They are follow-up error messages after a redeclaration
// error.
@ -208,10 +219,6 @@ func checkFiles(t *testing.T, testfiles []string) {
ctxt.Check(pkgName, fset, files...)
if *listErrors {
t.Errorf("--- %s: %d errors found", pkgName, len(errlist))
for _, err := range errlist {
t.Error(err)
}
return
}