From: Ian Lance Taylor Date: Mon, 18 May 2020 22:44:33 +0000 (-0700) Subject: doc/go1.15: mention vet warning for impossible type assertions X-Git-Tag: go1.15beta1~137 X-Git-Url: http://www.git.cypherpunks.su/?a=commitdiff_plain;h=0d39dba6dea120f677a55be83d760acb89a7195d;p=gostls13.git 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 --- diff --git a/doc/go1.15.html b/doc/go1.15.html index 727175539d..43fc14f168 100644 --- a/doc/go1.15.html +++ b/doc/go1.15.html @@ -157,6 +157,32 @@ TODO the language.

+

New warning for impossible interface conversions

+ +

+ 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. +

+ +

+ There is no reason to write a type assertion that always fails, so + any code that triggers this vet check should be rewritten. +

+ +

+ This new vet check is enabled by default when using go test. +

+ +

+ 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. +

+

Runtime