From 1f81f22357a22a15b37ae60774b1560d2e7209dc Mon Sep 17 00:00:00 2001 From: Dave Collins Date: Thu, 17 Jan 2013 18:43:51 -0600 Subject: 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. --- spew/common.go | 12 +----------- 1 file changed, 1 insertion(+), 11 deletions(-) (limited to 'spew/common.go') 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) { -- cgit v1.2.3