From: Robert Griesemer Date: Mon, 22 Nov 2021 20:21:12 +0000 (-0800) Subject: doc/go1.18: document compiler change for "declared but not used" errors X-Git-Tag: go1.18beta1~208 X-Git-Url: http://www.git.cypherpunks.su/?a=commitdiff_plain;h=7fbe2f4cc877a02465f36e10e7547e03bcb6e1af;p=gostls13.git doc/go1.18: document compiler change for "declared but not used" errors Fixes #49214. For #47694. Change-Id: Iba68ed17bfd81890309b6a6732087f87a03e1350 Reviewed-on: https://go-review.googlesource.com/c/go/+/366274 Trust: Robert Griesemer Run-TryBot: Robert Griesemer TryBot-Result: Go Bot Reviewed-by: Ian Lance Taylor --- diff --git a/doc/go1.18.html b/doc/go1.18.html index 61bb8dbbcb..5f94aa86c4 100644 --- a/doc/go1.18.html +++ b/doc/go1.18.html @@ -29,6 +29,20 @@ Do not send CLs removing the interior tags from such phrases. TODO: complete this section

+

Bug fixes

+ +

+ The Go 1.18 compiler now correctly reports declared but not used errors + for variables that are set inside a function literal but are never used. Before Go 1.18, + the compiler did not report an error in such cases. This fixes long-outstanding compiler + issue #8560. As a result of this change, + (possibly incorrect) programs may not compile anymore. The necessary fix is + straightforward: fix the program if it was in fact incorrect, or use the offending + variable, for instance by assigning it to the blank identifier _. + Since go vet always pointed out this error, the number of affected + programs is likely very small. +

+

Generics