]> Cypherpunks repositories - gostls13.git/commitdiff
doc/go1.11: add note about vet checks for printf wrappers
authorAndrew Bonventre <andybons@golang.org>
Thu, 9 Aug 2018 23:43:54 +0000 (19:43 -0400)
committerAndrew Bonventre <andybons@golang.org>
Thu, 9 Aug 2018 23:56:40 +0000 (23:56 +0000)
Fixes golang/go#26372

Change-Id: I30716ba56f829c6e36ccd50471e118084bad7360
Reviewed-on: https://go-review.googlesource.com/128902
Reviewed-by: Russ Cox <rsc@golang.org>
doc/go1.11.html

index e76e21c52e38339a91f9e712f0e82fb37e28bdf2..a1249db475ad9677b18d0aea00989e7a00189fac 100644 (file)
@@ -299,6 +299,22 @@ func f(v interface{}) {
   a warning to be printed, and <code>vet</code> to exit with status 1.
 </p>
 
+<p><!-- CL 108559 -->
+  Additionally, <a href="/cmd/vet"><code>go</code>&nbsp;<code>vet</code></a>
+  has become more robust when format-checking <code>printf</code> wrappers.
+  Vet now detects the mistake in this example:
+</p>
+
+<pre>
+func wrapper(s string, args ...interface{}) {
+       fmt.Printf(s, args...)
+}
+
+func main() {
+       wrapper("%s", 42)
+}
+</pre>
+
 <h3 id="trace">Trace</h3>
 
 <p><!-- CL 63274 -->