]> Cypherpunks repositories - gostls13.git/commitdiff
doc/go1.15: mention vet warning for impossible type assertions
authorIan Lance Taylor <iant@golang.org>
Mon, 18 May 2020 22:44:33 +0000 (15:44 -0700)
committerIan Lance Taylor <iant@golang.org>
Mon, 18 May 2020 23:05:20 +0000 (23:05 +0000)
For #4483

Change-Id: Iab76baf50b79eda1e3acfd662d0e7830c7962f5d
Reviewed-on: https://go-review.googlesource.com/c/go/+/234518
Reviewed-by: Robert Griesemer <gri@golang.org>
doc/go1.15.html

index 727175539d98e0ce23107b00b6d5fd9abb9bed7e..43fc14f168a9b50d0592a22372078b6e363637ba 100644 (file)
@@ -157,6 +157,32 @@ TODO
   the language.
 </p>
 
+<h4 id="vet-impossible-interface">New warning for impossible interface conversions</h4>
+
+<p><!-- CL 218779, 232660 -->
+  The vet tool now warns about type assertions from one interface type
+  to another interface type when the type assertion will always fail.
+  This will happen if both interface types implement a method with the
+  same name but with a different type signature.
+</p>
+
+<p>
+  There is no reason to write a type assertion that always fails, so
+  any code that triggers this vet check should be rewritten.
+</p>
+
+<p>
+  This new vet check is enabled by default when using <code>go test</code>.
+</p>
+
+<p>
+  We are considering prohibiting impossible interface type assertions
+  in a future release of Go.
+  Such a language change would not be backward compatible.
+  We are using this vet check as a first trial step toward changing
+  the language.
+</p>
+
 <h2 id="runtime">Runtime</h2>
 
 <p>