Skip to main content
Journey Uncommon Logo
JourneyUncommon
mediumGotable-driven testsSingle-choice MCQ

Why does calling t.Fatal from inside a goroutine spawned by your test (not the test's own goroutine) lead to broken behavior?

func TestWorker(t *testing.T) { go func() { if doWork() != nil { t.Fatal("work failed") } }() time.Sleep(time.Second) }