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 <emm.odeke@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
This commit is contained in:
Emmanuel T Odeke 2020-01-02 02:00:55 -08:00 committed by Emmanuel Odeke
parent a65f088301
commit f376b8510e
3 changed files with 11 additions and 3 deletions

View file

@ -629,7 +629,8 @@ func TestPoolExhaustOnCancel(t *testing.T) {
go func() {
rows, err := db.Query("SELECT|people|name,photo|")
if err != nil {
t.Fatalf("Query: %v", err)
t.Errorf("Query: %v", err)
return
}
rows.Close()
saturateDone.Done()
@ -637,6 +638,9 @@ func TestPoolExhaustOnCancel(t *testing.T) {
}
saturate.Wait()
if t.Failed() {
t.FailNow()
}
state = 2
// Now cancel the request while it is waiting.

View file

@ -998,12 +998,16 @@ func TestConcurrentPreferGoResolversDial(t *testing.T) {
defer wg.Done()
_, err := r.LookupIPAddr(context.Background(), "google.com")
if err != nil {
t.Fatalf("lookup failed for resolver %d: %q", index, err)
t.Errorf("lookup failed for resolver %d: %q", index, err)
}
}(resolver.Resolver, i)
}
wg.Wait()
if t.Failed() {
t.FailNow()
}
for i, resolver := range resolvers {
if !resolver.dialed {
t.Errorf("custom resolver %d not dialed during lookup", i)

View file

@ -356,7 +356,7 @@ func TestTimerStopStress(t *testing.T) {
for i := 0; i < 100; i++ {
go func(i int) {
timer := AfterFunc(2*Second, func() {
t.Fatalf("timer %d was not stopped", i)
t.Errorf("timer %d was not stopped", i)
})
Sleep(1 * Second)
timer.Stop()