]> Cypherpunks repositories - gostls13.git/commitdiff
cmd/vet: print: permit '#' flag in %e, %f, and %g
authorAlan Donovan <adonovan@google.com>
Fri, 8 Sep 2017 18:45:59 +0000 (14:45 -0400)
committerAlan Donovan <adonovan@google.com>
Mon, 11 Sep 2017 18:11:48 +0000 (18:11 +0000)
+ 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>

src/cmd/vet/print.go
src/cmd/vet/testdata/print.go

index dae307695b268f7a3f20418952d693feecfe33e1..21bb0d09972a698f743b020ae4690f8d8001bea7 100644 (file)
@@ -440,12 +440,12 @@ var printVerbs = []printVerb{
        {'b', numFlag, argInt | argFloat | argComplex},
        {'c', "-", argRune | argInt},
        {'d', numFlag, argInt},
-       {'e', numFlag, argFloat | argComplex},
-       {'E', numFlag, argFloat | argComplex},
-       {'f', numFlag, argFloat | argComplex},
-       {'F', numFlag, argFloat | argComplex},
-       {'g', numFlag, argFloat | argComplex},
-       {'G', numFlag, argFloat | argComplex},
+       {'e', sharpNumFlag, argFloat | argComplex},
+       {'E', sharpNumFlag, argFloat | argComplex},
+       {'f', sharpNumFlag, argFloat | argComplex},
+       {'F', sharpNumFlag, argFloat | argComplex},
+       {'g', sharpNumFlag, argFloat | argComplex},
+       {'G', sharpNumFlag, argFloat | argComplex},
        {'o', sharpNumFlag, argInt},
        {'p', "-#", argPointer},
        {'q', " -+.0#", argRune | argInt | argString},
index 219b895ea06b5c19532ef200e20ee2471eecb6e3..38743b109e093e4e41f730cb06df02c1e4a8d1c3 100644 (file)
@@ -102,6 +102,7 @@ func PrintfTests() {
        fmt.Printf("%s", interface{}(nil)) // Nothing useful we can say.
 
        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
        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"