From 766f89b5c625f8c57492cf5645576d9e6f450cc2 Mon Sep 17 00:00:00 2001 From: Tim King Date: Thu, 9 Dec 2021 11:06:25 -0800 Subject: [PATCH] doc: document cmd/vet changes for 1.18 release cmd/vet has several precision improvements for the checkers copylock, printf, sortslice, testinggoroutine, and tests. Adds a high level mention in the release notes and an example of string constant concatenation. Updates #47694 Change-Id: I7a342a57ca3fd9e2f3e8ec99f7b647269798317f Reviewed-on: https://go-review.googlesource.com/c/go/+/370734 Reviewed-by: Russ Cox Reviewed-by: Robert Findley Trust: Tim King Run-TryBot: Tim King TryBot-Result: Gopher Robot --- doc/go1.18.html | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/doc/go1.18.html b/doc/go1.18.html index 8142a93b7b..67af3e6a90 100644 --- a/doc/go1.18.html +++ b/doc/go1.18.html @@ -288,6 +288,21 @@ Do not send CLs removing the interior tags from such phrases. }

+

Precision improvements for existing checkers

+ +

+ The cmd/vet checkers copylock, printf, + sortslice, testinggoroutine, and tests + have all had moderate precision improvements to handle additional code patterns. + This may lead to newly reported errors in existing packages. For example, the + printf checker now tracks formatting strings created by + concatenating string constants. So vet will report an error in: +

+  // fmt.Printf formatting directive %d is being passed to Println.
+  fmt.Println("%d"+` ≡ x (mod 2)`+"\n", x%2)
+
+

+

Runtime