diff --git a/doc/go1.16.html b/doc/go1.16.html index 44d9707c16..e0187effd7 100644 --- a/doc/go1.16.html +++ b/doc/go1.16.html @@ -283,12 +283,55 @@ Do not send CLs removing the interior tags from such phrases.
- TODO +
+ The vet tool now warns about invalid calls to the testing.T
+ method Fatal from within a goroutine created during the test.
+ This also warns on calls to Fatalf, FailNow, and
+ Skip{,f,Now} methods on testing.T tests or
+ testing.B benchmarks.
+ Calls to these methods stop the execution of the created goroutine and not
+ the Test* or Benchmark* function. So these are
+ required to be called by the goroutine
+ running the test or benchmark function. For example:
+
+func TestFoo(t *testing.T) {
+ go func() {
+ if condition() {
+ t.Fatal("oops") // This exits the inner func instead of TestFoo.
+ }
+ ...
+ }()
+}
+
+
+
+ Code calling t.Fatal (or a similar method) from a created
+ goroutine should be rewritten to signal the test failure using
+ t.Error and exit the goroutine early using an alternative
+ method, such as using a return statement. The previous example
+ could be rewritten as:
+
+func TestFoo(t *testing.T) {
+ go func() {
+ if condition() {
+ t.Error("oops")
+ return
+ }
+ ...
+ }()
+}
+
+
The vet tool now warns about amd64 assembly that clobbers the BP register (the frame pointer) without saving and restoring it,