diff --git a/pp_test.go b/pp_test.go index 6104025..2a22b8e 100644 --- a/pp_test.go +++ b/pp_test.go @@ -162,7 +162,11 @@ func TestStructPrintingWithTags(t *testing.T) { } func TestStructPrintingWithOmitEmpty(t *testing.T) { - type Bar struct{ StringField string } + type Bar struct { + StringField string + IntField int + } + type Foo struct { StringField string StringPtr *string @@ -182,7 +186,7 @@ func TestStructPrintingWithOmitEmpty(t *testing.T) { want string }{ { - name: "all set", + name: "set", foo: Foo{ StringField: "foo", StringPtr: &stringVal, diff --git a/printer.go b/printer.go index ef3c889..6f1214c 100644 --- a/printer.go +++ b/printer.go @@ -477,7 +477,7 @@ func (p *printer) colorize(text string, color uint16) string { } func (p *printer) format(object interface{}) string { - pp := newPrinter(object, p.currentScheme, p.maxDepth, p.coloringEnabled, p.decimalUint, p.exportedOnly, p.thousandsSeparator, false) + pp := newPrinter(object, p.currentScheme, p.maxDepth, p.coloringEnabled, p.decimalUint, p.exportedOnly, p.thousandsSeparator, p.omitEmpty) pp.depth = p.depth pp.visited = p.visited if value, ok := object.(reflect.Value); ok {