Skip to content

Commit

Permalink
cmd/vet: print: permit '#' flag in %e, %f, and %g
Browse files Browse the repository at this point in the history
+ Test

Change-Id: I7b42ff70f26a58e1cf58cbbc53d02a65623456ae
Reviewed-on: https://go-review.googlesource.com/62371
Run-TryBot: Ian Lance Taylor <[email protected]>
Reviewed-by: Rob Pike <[email protected]>
TryBot-Result: Gobot Gobot <[email protected]>
  • Loading branch information
adonovan committed Sep 11, 2017
1 parent b74b43d commit 7159ab4
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 6 deletions.
12 changes: 6 additions & 6 deletions src/cmd/vet/print.go
Original file line number Diff line number Diff line change
Expand Up @@ -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},
Expand Down
1 change: 1 addition & 0 deletions src/cmd/vet/testdata/print.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down

0 comments on commit 7159ab4

Please sign in to comment.