]> Cypherpunks repositories - gostls13.git/commit
fmt: only use Stringer or Error for strings
authorRob Pike <r@golang.org>
Tue, 6 Dec 2011 00:45:51 +0000 (16:45 -0800)
committerRob Pike <r@golang.org>
Tue, 6 Dec 2011 00:45:51 +0000 (16:45 -0800)
commit2ed57a8cd86cec36b8370fb16d450e5a29a9375f
treed6db0e1140b4a503d892b3b19fab59ee4a9ded88
parentaf848926431da0345fd78c0dba0a513df44ee1cf
fmt: only use Stringer or Error for strings
This is a slight change to fmt's semantics, but means that if you use
%d to print an integer with a Stringable value, it will print as an integer.
This came up because Time.Month() couldn't cleanly print as an integer
rather than a name. Using %d on Stringables is silly anyway, so there
should be no effect outside the fmt tests.
As a mild bonus, certain recursive failures of String methods
will also be avoided this way.

R=golang-dev, adg
CC=golang-dev
https://golang.org/cl/5453053
src/pkg/fmt/doc.go
src/pkg/fmt/fmt_test.go
src/pkg/fmt/print.go