Skip to content

Commit 0941dbc

Browse files
matttproudianlancetaylor
authored andcommitted
testing: clarify in docs that TestMain is advanced
Beginner and intermediate Go users periodically use TestMain when requirements do not necessitate TestMain (exceeding least-mechanism design). This commit expands package testing's documentation to convey that the TestMain feature itself is somewhat low-level and potentially unsuitable for casual testing where ordinary test functions would suffice. Fixes #42161 Updates #44200 Change-Id: I91ba0b048c3d6f79110fe8f0fbb58d896edca366 Reviewed-on: https://go-review.googlesource.com/c/go/+/334649 Trust: Ian Lance Taylor <[email protected]> Run-TryBot: Ian Lance Taylor <[email protected]> TryBot-Result: Go Bot <[email protected]> Reviewed-by: Rob Pike <[email protected]>
1 parent 69728ea commit 0941dbc

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

src/testing/testing.go

+2
Original file line numberDiff line numberDiff line change
@@ -233,6 +233,8 @@
233233
// os.Exit(m.Run())
234234
// }
235235
//
236+
// TestMain is a low-level primitive and should not be necessary for casual
237+
// testing needs, where ordinary test functions suffice.
236238
package testing
237239

238240
import (

0 commit comments

Comments
 (0)