From e18a70d44672c68a171c43d797873722f17a5c02 Mon Sep 17 00:00:00 2001 From: Jakub Warczarek Date: Wed, 31 May 2023 11:34:43 +0200 Subject: [PATCH] Document that require is not safe to call in created goroutines --- README.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/README.md b/README.md index 2c4468e..de8599b 100644 --- a/README.md +++ b/README.md @@ -104,6 +104,8 @@ func TestSomething(t *testing.T) { --------------------------------------------------------------------------------------------- The `require` package provides same global functions as the `assert` package, but instead of returning a boolean result they terminate current test. +These functions must be called from the goroutine running the test or benchmark function, not from other goroutines created during the test. +Otherwise race conditions may occur. See [t.FailNow](http://golang.org/pkg/testing/#T.FailNow) for details.