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/common.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/common.go')
| -rw-r--r-- | spew/common.go | 12 |
1 files changed, 1 insertions, 11 deletions
diff --git a/spew/common.go b/spew/common.go index 30fb450..945b0b0 100644 --- a/spew/common.go +++ b/spew/common.go @@ -70,7 +70,7 @@ var ( iBytes = []byte("i") trueBytes = []byte("true") falseBytes = []byte("false") - interfaceBytes = []byte("(interface {}) ") + interfaceBytes = []byte("(interface {})") commaNewlineBytes = []byte(",\n") newlineBytes = []byte("\n") openBraceBytes = []byte("{") @@ -102,16 +102,6 @@ var ( // hexDigits is used to map a decimal value to a hex digit. var hexDigits = "0123456789abcdef" -// unpackValue returns values inside of non-nil interfaces when possible. -// This is useful for data types like structs, arrays, slices, and maps which -// can contain varying types packed inside an interface. -func unpackValue(v reflect.Value) reflect.Value { - if v.Kind() == reflect.Interface && !v.IsNil() { - v = v.Elem() - } - return v -} - // catchPanic handles any panics that might occur during the handleMethods // calls. func catchPanic(w io.Writer, v reflect.Value) { |
