From f26c131d080bd26f3405d530e56b3f1c1d4c30d6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ville=20Skytt=C3=A4?= Date: Tue, 31 Oct 2023 10:50:30 +0200 Subject: [PATCH] testing: note FailNow does not prevent Cleanup functions FailNow's documentation is fairly detailed about the way it causes execution to stop, and what runs after it has been called. However, from the Cleanup documentation it is not clear if functions registered with it would meet this criteria. Add an explicit note to clarify. --- src/testing/testing.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/testing/testing.go b/src/testing/testing.go index 6e277a40f93cae..d9111b63b355d7 100644 --- a/src/testing/testing.go +++ b/src/testing/testing.go @@ -970,7 +970,7 @@ func (c *common) Failed() bool { // FailNow marks the function as having failed and stops its execution // by calling runtime.Goexit (which then runs all deferred calls in the -// current goroutine). +// current goroutine, as well as ones registered with Cleanup for the current test or benchmark). // Execution will continue at the next test or benchmark. // FailNow must be called from the goroutine running the // test or benchmark function, not from other goroutines