Commit 3f1ed245 authored by Josh Bleecher Snyder's avatar Josh Bleecher Snyder

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: default avatarRobert Griesemer <gri@golang.org>
Reviewed-by: default avatarBrad Fitzpatrick <bradfitz@golang.org>
parent 84803f3d
......@@ -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
......
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