From bccbf59046b9d1289f3cbf0240d02b8ae550e0ac Mon Sep 17 00:00:00 2001
From: Alberto Donizetti
Date: Thu, 28 Jun 2018 20:22:13 +0200
Subject: [PATCH] doc/go1.11: explain new vet typechecking behaviour in release
notes
Since Go1.10, go test runs vet on the tests before executing them.
Moreover, the vet tool typechecks the package under analysis with
go/types before running. In Go1.10, a typechecking failure just caused
a warning to be printed. In Go1.11, a typechecking failure will cause
vet to exit with a fatal error (see Issue #21287).
This means that starting with Go1.11, tests that don't typecheck will
fail immediately. This would not normally be an issue, since a test
that doesn't typecheck shouldn't even compile, and it should already
be broken.
Unfortunately, there's a bug in gc that makes it accept programs with
unused variables inside a closure (Issue #3059). This means that a
test with an unused variable inside a closure, that compiled and
passed in Go1.10, will fail in the typechecking step of vet starting
with Go1.11.
Explain this in the 1.11 release notes.
Fixes #26109
Change-Id: I970c1033ab6bc985d8c64bd24f56e854af155f96
Reviewed-on: https://go-review.googlesource.com/121455
Reviewed-by: Ian Lance Taylor
---
doc/go1.11.html | 29 +++++++++++++++++++++++++++++
1 file changed, 29 insertions(+)
diff --git a/doc/go1.11.html b/doc/go1.11.html
index 2ce6875bdb..e3a2f5f0f5 100644
--- a/doc/go1.11.html
+++ b/doc/go1.11.html
@@ -157,6 +157,35 @@ Do not send CLs removing the interior tags from such phrases.
please file an issue to let us know about them.
+
+
+Test
+
+
+ Since Go1.10, the go
test
command runs
+ go
vet
on the package being tested,
+ to identify problems before running the test. Since vet
+ typechecks the code with go/types
+ before running, tests that do not typecheck will now fail.
+
+ In particular, tests that contain an unused variable inside a
+ closure compiled with Go1.10, because the Go compiler incorrectly
+ accepted them (Issue #3059),
+ but will now fail, since go/types
correctly reports an
+ "unused variable" error in this case.
+
+
+
+Vet
+
+
+ The go
vet
+ command now reports a fatal error when the package under analysis
+ does not typecheck. Previously, a type checking error simply caused
+ a warning to be printed, and vet
to exit with status 1.
+
+
+
Core library
--
2.51.0