diff --git a/mock/mock.go b/mock/mock.go index eb5682d..3f53d22 100644 --- a/mock/mock.go +++ b/mock/mock.go @@ -332,6 +332,8 @@ func (m *Mock) TestData() objx.Map { */ // Test sets the test struct variable of the mock object +// Test should not be called on an object that is going to be used in a +// goroutine other than the one running the test function. func (m *Mock) Test(t TestingT) { m.mutex.Lock() defer m.mutex.Unlock() diff --git a/require/doc.go b/require/doc.go index 9684347..c8e3f94 100644 --- a/require/doc.go +++ b/require/doc.go @@ -23,6 +23,8 @@ // // The `require` package have same global functions as in the `assert` package, // but instead of returning a boolean result they call `t.FailNow()`. +// A consequence of this is that it must be called from the goroutine running +// the test function, not from other goroutines created during the test. // // Every assertion function also takes an optional string message as the final argument, // allowing custom error messages to be appended to the message the assertion method outputs.