%#v on simple types

84 views
Skip to first unread message

Dan Kortschak

unread,
Oct 10, 2013, 7:19:35 PM10/10/13
to golang-nuts
When you fmt a simple type using the %#v Go syntax flag, for example
here http://play.golang.org/p/o6lnyYqwf8 you get exactly the same result
as with the standard %v verb. Is there any design reason you don't get
something like "float64(1)"?

Rob Pike

unread,
Oct 10, 2013, 7:32:26 PM10/10/13
to Dan Kortschak, golang-nuts
Didn't think of it, never tried it, might be worthwhile, might be an incompatibility.

-rob

Dan Kortschak

unread,
Oct 10, 2013, 7:52:02 PM10/10/13
to Rob Pike, golang-nuts
I can put together a post-1.2 CL and file an issue for it if that will
be entertained.

Dan

Rob Pike

unread,
Oct 10, 2013, 8:13:57 PM10/10/13
to Dan Kortschak, golang-nuts
For now just file an issue. I'm not convinced it's a good idea.

Kevin Gillette

unread,
Oct 10, 2013, 8:43:10 PM10/10/13
to golan...@googlegroups.com, Dan Kortschak
I'm convinced that nobody should be relying on the output of %#v for any kind of exchange format, instead favoring one of the encoding packages for anything "real", yet it would still seem to fall under the Go 1 guarantee.

Dan Kortschak

unread,
Oct 10, 2013, 8:49:06 PM10/10/13
to Kevin Gillette, golan...@googlegroups.com
On Thu, 2013-10-10 at 17:43 -0700, Kevin Gillette wrote:
> I'm convinced that nobody *should* be relying on the output of %#v for
> any kind of exchange format, instead favoring one of the encoding
> packages for anything "real", yet it would still seem to fall under
> the Go 1 guarantee.

Agreed on both of those. The most likely place conflicts will arise is
in testing.

Reply all
Reply to author
Forward
0 new messages