Skip to content

Commit f376b85

Browse files
committed
all: fix invalid invocations of Fatalf in goroutines
Found by running the go vet pass 'testinggoroutine' that I started in CL 212920. Change-Id: Ic9462fac85dbafc437fe4a323b886755a67a1efa Reviewed-on: https://go-review.googlesource.com/c/go/+/213097 Run-TryBot: Emmanuel Odeke <[email protected]> TryBot-Result: Gobot Gobot <[email protected]> Reviewed-by: Ian Lance Taylor <[email protected]>
1 parent a65f088 commit f376b85

File tree

3 files changed

+11
-3
lines changed

3 files changed

+11
-3
lines changed

src/database/sql/sql_test.go

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -629,14 +629,18 @@ func TestPoolExhaustOnCancel(t *testing.T) {
629629
go func() {
630630
rows, err := db.Query("SELECT|people|name,photo|")
631631
if err != nil {
632-
t.Fatalf("Query: %v", err)
632+
t.Errorf("Query: %v", err)
633+
return
633634
}
634635
rows.Close()
635636
saturateDone.Done()
636637
}()
637638
}
638639

639640
saturate.Wait()
641+
if t.Failed() {
642+
t.FailNow()
643+
}
640644
state = 2
641645

642646
// Now cancel the request while it is waiting.

src/net/lookup_test.go

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -998,12 +998,16 @@ func TestConcurrentPreferGoResolversDial(t *testing.T) {
998998
defer wg.Done()
999999
_, err := r.LookupIPAddr(context.Background(), "google.com")
10001000
if err != nil {
1001-
t.Fatalf("lookup failed for resolver %d: %q", index, err)
1001+
t.Errorf("lookup failed for resolver %d: %q", index, err)
10021002
}
10031003
}(resolver.Resolver, i)
10041004
}
10051005
wg.Wait()
10061006

1007+
if t.Failed() {
1008+
t.FailNow()
1009+
}
1010+
10071011
for i, resolver := range resolvers {
10081012
if !resolver.dialed {
10091013
t.Errorf("custom resolver %d not dialed during lookup", i)

src/time/sleep_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -356,7 +356,7 @@ func TestTimerStopStress(t *testing.T) {
356356
for i := 0; i < 100; i++ {
357357
go func(i int) {
358358
timer := AfterFunc(2*Second, func() {
359-
t.Fatalf("timer %d was not stopped", i)
359+
t.Errorf("timer %d was not stopped", i)
360360
})
361361
Sleep(1 * Second)
362362
timer.Stop()

0 commit comments

Comments
 (0)