]> Cypherpunks repositories - gostls13.git/commit
fmt: make the %#v verb a special flag
authorRob Pike <r@golang.org>
Thu, 2 Oct 2014 21:16:58 +0000 (14:16 -0700)
committerRob Pike <r@golang.org>
Thu, 2 Oct 2014 21:16:58 +0000 (14:16 -0700)
commit7c8e057ad3b4fed16719d9ef91936537dff90ecd
tree62f700c28dcba6a0768f8a0f194e1f9bd54652b7
parent28ddfb090c2824d60e30007cf171b5dc1e8935e2
fmt: make the %#v verb a special flag
The %#v verb is special: it says all values below need to print as %#v.
However, for some situations the # flag has other meanings and this
causes some issues, particularly in how Formatters work. Since %#v
dominates all formatting, translate it into actual state of the formatter
and decouple it from the # flag itself within the calculations (although
it must be restored when methods are doing the work.)
The result is cleaner code and correct handling of # for Formatters.
TODO: Apply the same thinking to the + flag in a followup CL.

Also, the wasString return value in handleMethods is always false,
so eliminate it.

Update #8835

LGTM=iant
R=golang-codereviews, iant
CC=golang-codereviews
https://golang.org/cl/146650043
src/fmt/fmt_test.go
src/fmt/format.go
src/fmt/print.go