diff --git a/src/cmd/vet/print.go b/src/cmd/vet/print.go index dae307695b..21bb0d0997 100644 --- a/src/cmd/vet/print.go +++ b/src/cmd/vet/print.go @@ -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}, diff --git a/src/cmd/vet/testdata/print.go b/src/cmd/vet/testdata/print.go index 219b895ea0..38743b109e 100644 --- a/src/cmd/vet/testdata/print.go +++ b/src/cmd/vet/testdata/print.go @@ -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"