From 0d39dba6dea120f677a55be83d760acb89a7195d Mon Sep 17 00:00:00 2001 From: Ian Lance Taylor Date: Mon, 18 May 2020 15:44:33 -0700 Subject: [PATCH] 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 --- doc/go1.15.html | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) 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

-- 2.50.0