mirror of
https://github.com/golang/go
synced 2024-11-11 21:20:21 -07:00
doc/go1.15: mention vet warning for impossible type assertions
For #4483 Change-Id: Iab76baf50b79eda1e3acfd662d0e7830c7962f5d Reviewed-on: https://go-review.googlesource.com/c/go/+/234518 Reviewed-by: Robert Griesemer <gri@golang.org>
This commit is contained in:
parent
b0bc18d5bc
commit
0d39dba6de
@ -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>
|
||||
|
Loading…
Reference in New Issue
Block a user