1
0
mirror of https://github.com/golang/go synced 2024-11-19 19:04:47 -07:00

cmd/compile/internal/syntax: avoid deadlock

When the err from ReadFile is non-nil, we call t.Fatal(err).
Switch t.Fatal to t.Error + return.
ensure that close(results) happens on that code path as well.

Updates #17697.

Change-Id: Ifaacf27a76c175446d642086ff32f4386428080d
Reviewed-on: https://go-review.googlesource.com/32486
Run-TryBot: Josh Bleecher Snyder <josharian@gmail.com>
Reviewed-by: Robert Griesemer <gri@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
This commit is contained in:
Josh Bleecher Snyder 2016-11-01 12:27:26 -07:00
parent 84803f3da1
commit 3f1ed24551

View File

@ -44,6 +44,7 @@ func TestStdLib(t *testing.T) {
results := make(chan parseResult)
go func() {
defer close(results)
for _, dir := range []string{
runtime.GOROOT(),
//"/Users/gri/src",
@ -54,7 +55,8 @@ func TestStdLib(t *testing.T) {
}
ast, err := ReadFile(filename, nil, nil, 0)
if err != nil {
t.Fatal(err)
t.Error(err)
return
}
if *verify {
verifyPrint(filename, ast)
@ -62,7 +64,6 @@ func TestStdLib(t *testing.T) {
results <- parseResult{filename, ast.Lines}
})
}
close(results)
}()
var count, lines int