diff options
| author | Dave Collins <[email protected]> | 2013-01-17 18:43:51 -0600 |
|---|---|---|
| committer | Dave Collins <[email protected]> | 2013-01-17 18:43:51 -0600 |
| commit | 1f81f22357a22a15b37ae60774b1560d2e7209dc (patch) | |
| tree | e37ef48ff3d523e3eed3cbc9b7512b74e2fdd7d0 /spew/spew.go | |
| parent | c5fba05307d6a83b518916402fcf1fc867ce0782 (diff) | |
Implement support for %#v and %#+v in Formatter.
This commit implements feature request #3. In particular, it allows the
formatter to respond to %#v and %#+v. The # flag (%#v) adds type
information to the output and the combination of the # and + flags (%#+v)
adds both type information and pointer information. This allows the
consumer a choice between displaying types, pointer information, or both.
Diffstat (limited to 'spew/spew.go')
| -rw-r--r-- | spew/spew.go | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/spew/spew.go b/spew/spew.go index 0622cde..657664b 100644 --- a/spew/spew.go +++ b/spew/spew.go @@ -226,11 +226,12 @@ interface. As a result, it integrates cleanly with standard fmt package printing functions. The formatter is useful for inline printing of smaller data types similar to the standard %v format specifier. -The custom formatter only responds to the %v and %+v verb combinations. Any -other variations such as %x, %q, and %#v will be sent to the the standard fmt -package for formatting. In addition, the custom formatter ignores the width and -precision arguments (however they will still work on the format specifiers not -handled by the custom formatter). +The custom formatter only responds to the %v (most compact), %+v (adds pointer +addresses), %#v (adds types), or %#+v (adds types and pointer addresses) verb +combinations. Any other verbs such as %x and %q will be sent to the the +standard fmt package for formatting. In addition, the custom formatter ignores +the width and precision arguments (however they will still work on the format +specifiers not handled by the custom formatter). Typically this function shouldn't be called directly. It is much easier to make use of the custom formatter by calling one of the convenience functions such as |
