Commit bb576704 authored by David Symonds's avatar David Symonds

cmd/vet: expand printf flags understood by %s and %q.

Fixes #4580.

R=golang-dev, adg
CC=golang-dev
https://golang.org/cl/7002043
parent 1dcf658f
......@@ -208,8 +208,8 @@ var printVerbs = []printVerb{
{'G', numFlag},
{'o', sharpNumFlag},
{'p', "-#"},
{'q', "-+#."},
{'s', "-."},
{'q', " -+.0"},
{'s', " -+.0"},
{'t', "-"},
{'T', "-"},
{'U', "-#"},
......@@ -282,6 +282,8 @@ func BadFunctionUsedInTests() {
fmt.Println("%s", "hi") // ERROR "possible formatting directive in Println call"
fmt.Printf("%s", "hi", 3) // ERROR "wrong number of args in Printf call"
fmt.Printf("%s%%%d", "hi", 3) // correct
fmt.Printf("%08s", "woo") // correct
fmt.Printf("% 8s", "woo") // correct
fmt.Printf("%.*d", 3, 3) // correct
fmt.Printf("%.*d", 3, 3, 3) // ERROR "wrong number of args in Printf call"
fmt.Printf("%q %q", multi()...) // ok
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment