Merge pull request #1392 from programmer04/improve-docs

Document that require is not safe to call in created goroutines
pull/1407/head
Olivier Mengué 2023-07-05 11:59:09 +02:00 committed by GitHub
commit 945f91b9b9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 2 additions and 0 deletions

View File

@ -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.