mirror of
https://github.com/golang/go
synced 2024-11-20 09:34:52 -07:00
cmd/vet: print: permit '#' flag in %e, %f, and %g
+ Test Change-Id: I7b42ff70f26a58e1cf58cbbc53d02a65623456ae Reviewed-on: https://go-review.googlesource.com/62371 Run-TryBot: Ian Lance Taylor <iant@golang.org> Reviewed-by: Rob Pike <r@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org>
This commit is contained in:
parent
b74b43de68
commit
7159ab4871
@ -440,12 +440,12 @@ var printVerbs = []printVerb{
|
|||||||
{'b', numFlag, argInt | argFloat | argComplex},
|
{'b', numFlag, argInt | argFloat | argComplex},
|
||||||
{'c', "-", argRune | argInt},
|
{'c', "-", argRune | argInt},
|
||||||
{'d', numFlag, argInt},
|
{'d', numFlag, argInt},
|
||||||
{'e', numFlag, argFloat | argComplex},
|
{'e', sharpNumFlag, argFloat | argComplex},
|
||||||
{'E', numFlag, argFloat | argComplex},
|
{'E', sharpNumFlag, argFloat | argComplex},
|
||||||
{'f', numFlag, argFloat | argComplex},
|
{'f', sharpNumFlag, argFloat | argComplex},
|
||||||
{'F', numFlag, argFloat | argComplex},
|
{'F', sharpNumFlag, argFloat | argComplex},
|
||||||
{'g', numFlag, argFloat | argComplex},
|
{'g', sharpNumFlag, argFloat | argComplex},
|
||||||
{'G', numFlag, argFloat | argComplex},
|
{'G', sharpNumFlag, argFloat | argComplex},
|
||||||
{'o', sharpNumFlag, argInt},
|
{'o', sharpNumFlag, argInt},
|
||||||
{'p', "-#", argPointer},
|
{'p', "-#", argPointer},
|
||||||
{'q', " -+.0#", argRune | argInt | argString},
|
{'q', " -+.0#", argRune | argInt | argString},
|
||||||
|
1
src/cmd/vet/testdata/print.go
vendored
1
src/cmd/vet/testdata/print.go
vendored
@ -102,6 +102,7 @@ func PrintfTests() {
|
|||||||
fmt.Printf("%s", interface{}(nil)) // Nothing useful we can say.
|
fmt.Printf("%s", interface{}(nil)) // Nothing useful we can say.
|
||||||
|
|
||||||
fmt.Printf("%g", 1+2i)
|
fmt.Printf("%g", 1+2i)
|
||||||
|
fmt.Printf("%#e %#E %#f %#F %#g %#G", 1.2, 1.2, 1.2, 1.2, 1.2, 1.2) // OK since Go 1.9
|
||||||
// Some bad format/argTypes
|
// Some bad format/argTypes
|
||||||
fmt.Printf("%b", "hi") // ERROR "arg .hi. for printf verb %b of wrong type"
|
fmt.Printf("%b", "hi") // ERROR "arg .hi. for printf verb %b of wrong type"
|
||||||
fmt.Printf("%t", c) // ERROR "arg c for printf verb %t of wrong type"
|
fmt.Printf("%t", c) // ERROR "arg c for printf verb %t of wrong type"
|
||||||
|
Loading…
Reference in New Issue
Block a user