diff --git a/demo/demo.png b/demo/demo.png index fcd5f71..909b1ad 100644 Binary files a/demo/demo.png and b/demo/demo.png differ diff --git a/dumper.go b/dumper.go index 566bbc5..e78db47 100644 --- a/dumper.go +++ b/dumper.go @@ -13,11 +13,12 @@ type pointer struct { } type dumper struct { - buf []byte - indentation string - theme theme - depth int - ptrs map[uintptr]*pointer + buf []byte + indentation string + dumpPrivateFields bool + theme theme + depth int + ptrs map[uintptr]*pointer } func (d *dumper) dump(val reflect.Value, ignore_depth ...bool) { @@ -148,16 +149,16 @@ func (d *dumper) tagPtr(ptr *pointer) { } func (d *dumper) dumpStruct(v reflect.Value) { - vtype := v.Type() + vtype, numFields := v.Type(), v.NumField() - if t := vtype.String(); t == "" { + if t := vtype.String(); strings.HasPrefix(t, "struct") { d.write(d.theme.VarType.apply("struct {")) } else { d.write(d.theme.VarType.apply(t + " {")) } d.depth++ - for i := 0; i < v.NumField(); i++ { + for i := 0; i < numFields; i++ { d.write("\n") d.indent() @@ -165,7 +166,7 @@ func (d *dumper) dumpStruct(v reflect.Value) { d.write(d.theme.StructField.apply(key.Name)) d.write((": ")) - if !key.IsExported() { + if !key.IsExported() && !d.dumpPrivateFields { d.write(d.theme.VarType.apply(key.Type.String())) } else { d.dump(v.Field(i), true) @@ -175,7 +176,7 @@ func (d *dumper) dumpStruct(v reflect.Value) { } d.depth-- - if v.NumField() > 0 { + if numFields > 0 { d.write("\n") d.indent() } diff --git a/dumper_test.go b/dumper_test.go index 8b21c6c..abbf138 100644 --- a/dumper_test.go +++ b/dumper_test.go @@ -183,6 +183,8 @@ func TestDumper(t *testing.T) { {make(map[any]any), "map[interface {}]interface {}:0 {}"}, {map[string]int{"x": 123}, `map[string]int:1 { "x": 123, +}`}, {struct{ Name string }{"yassinebenaid"}, `struct { + Name: "yassinebenaid", }`}, } @@ -285,298 +287,298 @@ type NamedTypes struct { NamedMap map[string]string } -func TestDumperWithComplexDataStructure(t *testing.T) { - var intValue = 42 - var strValue = "example" - var mapValue = map[string]int{"key1": 1} +var intValue = 42 +var strValue = "example" +var mapValue = map[string]int{"key1": 1} - channelInt := make(chan int) - channelStr := make(chan string) - channelStruct := make(chan Detail) - channelSub := make(chan *SubNode) +var channelInt = make(chan int) +var channelStr = make(chan string) +var channelStruct = make(chan Detail) +var channelSub = make(chan *SubNode) - var cyclicNode *Node +var cyclicNode *Node - root := &Node{ - ID: 1, - Int8Field: int8(8), - Int16Field: int16(16), - Int32Field: int32(32), - Int64Field: int64(64), - UintField: uint(100), - Uint8Field: uint8(200), - Uint16Field: uint16(300), - Uint32Field: uint32(400), - Uint64Field: uint64(500), - UintptrField: uintptr(600), - Float32Field: float32(123.456), - Float64Field: 789.012, - Complex64Field: complex64(1 + 2i), - Complex128Field: complex128(cmplx.Exp(1 + 2i)), - StringField: "RootNode", - BoolField: true, - Array: [3]int{1, 2, 3}, - Children: []*Node{ - { - ID: 2, - Int8Field: int8(18), - Int16Field: int16(116), - Int32Field: int32(132), - Int64Field: int64(164), - UintField: uint(1100), - Uint8Field: uint8(100), - Uint16Field: uint16(1300), - Uint32Field: uint32(1400), - Uint64Field: uint64(1500), - UintptrField: uintptr(1600), - Float32Field: float32(223.456), - Float64Field: 1789.012, - Complex64Field: complex64(2 + 3i), - Complex128Field: complex128(cmplx.Exp(2 + 3i)), - StringField: "ChildNode1", - BoolField: false, - Array: [3]int{4, 5, 6}, - IntPointer: &intValue, - StringPointer: &strValue, - MapPointer: &mapValue, - ChannelInt: channelInt, - ChannelStr: channelStr, - ChannelStruct: channelStruct, - Attributes: map[string]interface{}{ - "attr": []float64{1.1, 2.2, 3.3}, - }, - SubNode: &SubNode{ - Code: 100, - SubDetails: []Detail{ - { - Info: "Detail1", - Count: 1, - Next: &Detail{ - Info: "Detail2", - Count: 2, - Next: nil, - DetailMap: map[string]bool{"key1": true}, - DetailSlice: []complex64{1 + 1i, 2 + 2i}, - }, - DetailMap: map[string]bool{"key2": false}, - DetailSlice: []complex64{3 + 3i, 4 + 4i}, +var root = &Node{ + ID: 1, + Int8Field: int8(8), + Int16Field: int16(16), + Int32Field: int32(32), + Int64Field: int64(64), + UintField: uint(100), + Uint8Field: uint8(200), + Uint16Field: uint16(300), + Uint32Field: uint32(400), + Uint64Field: uint64(500), + UintptrField: uintptr(600), + Float32Field: float32(123.456), + Float64Field: 789.012, + Complex64Field: complex64(1 + 2i), + Complex128Field: complex128(cmplx.Exp(1 + 2i)), + StringField: "RootNode", + BoolField: true, + Array: [3]int{1, 2, 3}, + Children: []*Node{ + { + ID: 2, + Int8Field: int8(18), + Int16Field: int16(116), + Int32Field: int32(132), + Int64Field: int64(164), + UintField: uint(1100), + Uint8Field: uint8(100), + Uint16Field: uint16(1300), + Uint32Field: uint32(1400), + Uint64Field: uint64(1500), + UintptrField: uintptr(1600), + Float32Field: float32(223.456), + Float64Field: 1789.012, + Complex64Field: complex64(2 + 3i), + Complex128Field: complex128(cmplx.Exp(2 + 3i)), + StringField: "ChildNode1", + BoolField: false, + Array: [3]int{4, 5, 6}, + IntPointer: &intValue, + StringPointer: &strValue, + MapPointer: &mapValue, + ChannelInt: channelInt, + ChannelStr: channelStr, + ChannelStruct: channelStruct, + Attributes: map[string]interface{}{ + "attr": []float64{1.1, 2.2, 3.3}, + }, + SubNode: &SubNode{ + Code: 100, + SubDetails: []Detail{ + { + Info: "Detail1", + Count: 1, + Next: &Detail{ + Info: "Detail2", + Count: 2, + Next: nil, + DetailMap: map[string]bool{"key1": true}, + DetailSlice: []complex64{1 + 1i, 2 + 2i}, }, + DetailMap: map[string]bool{"key2": false}, + DetailSlice: []complex64{3 + 3i, 4 + 4i}, }, - ChannelSub: channelSub, }, - privateSubNode: &SubNode{ - Code: 100, - SubDetails: []Detail{ - { - Info: "Detail1", - Count: 1, - Next: &Detail{ - Info: "Detail2", - Count: 2, - Next: nil, - DetailMap: map[string]bool{"key1": true}, - DetailSlice: []complex64{1 + 1i, 2 + 2i}, - }, - DetailMap: map[string]bool{"key2": false}, - DetailSlice: []complex64{3 + 3i, 4 + 4i}, + ChannelSub: channelSub, + }, + privateSubNode: &SubNode{ + Code: 100, + SubDetails: []Detail{ + { + Info: "Detail1", + Count: 1, + Next: &Detail{ + Info: "Detail2", + Count: 2, + Next: nil, + DetailMap: map[string]bool{"key1": true}, + DetailSlice: []complex64{1 + 1i, 2 + 2i}, }, + DetailMap: map[string]bool{"key2": false}, + DetailSlice: []complex64{3 + 3i, 4 + 4i}, }, - ChannelSub: channelSub, }, + ChannelSub: channelSub, }, - { - ID: 3, - Int8Field: int8(28), - Int16Field: int16(216), - Int32Field: int32(232), - Int64Field: int64(264), - UintField: uint(2100), - Uint8Field: uint8(220), - Uint16Field: uint16(2300), - Uint32Field: uint32(2400), - Uint64Field: uint64(2500), - UintptrField: uintptr(2600), - Float32Field: float32(323.456), - Float64Field: 2789.012, - Complex64Field: complex64(3 + 4i), - Complex128Field: complex128(cmplx.Exp(3 + 4i)), - StringField: "ChildNode2", - BoolField: true, - Array: [3]int{7, 8, 9}, - IntPointer: &intValue, - StringPointer: &strValue, - MapPointer: &mapValue, - ChannelInt: channelInt, - ChannelStr: channelStr, - ChannelStruct: channelStruct, - Attributes: map[string]interface{}{ - "attr": []string{"a", "b", "c"}, - }, - SubNode: &SubNode{ - Code: 200, - SubDetails: []Detail{ - { - Info: "DetailA", - Count: 10, - Next: &Detail{ - Info: "DetailB", - Count: 20, - Next: nil, - DetailMap: map[string]bool{"key3": true}, - DetailSlice: []complex64{5 + 5i, 6 + 6i}, - }, - DetailMap: map[string]bool{"key4": false}, - DetailSlice: []complex64{7 + 7i, 8 + 8i}, + }, + { + ID: 3, + Int8Field: int8(28), + Int16Field: int16(216), + Int32Field: int32(232), + Int64Field: int64(264), + UintField: uint(2100), + Uint8Field: uint8(220), + Uint16Field: uint16(2300), + Uint32Field: uint32(2400), + Uint64Field: uint64(2500), + UintptrField: uintptr(2600), + Float32Field: float32(323.456), + Float64Field: 2789.012, + Complex64Field: complex64(3 + 4i), + Complex128Field: complex128(cmplx.Exp(3 + 4i)), + StringField: "ChildNode2", + BoolField: true, + Array: [3]int{7, 8, 9}, + IntPointer: &intValue, + StringPointer: &strValue, + MapPointer: &mapValue, + ChannelInt: channelInt, + ChannelStr: channelStr, + ChannelStruct: channelStruct, + Attributes: map[string]interface{}{ + "attr": []string{"a", "b", "c"}, + }, + SubNode: &SubNode{ + Code: 200, + SubDetails: []Detail{ + { + Info: "DetailA", + Count: 10, + Next: &Detail{ + Info: "DetailB", + Count: 20, + Next: nil, + DetailMap: map[string]bool{"key3": true}, + DetailSlice: []complex64{5 + 5i, 6 + 6i}, }, + DetailMap: map[string]bool{"key4": false}, + DetailSlice: []complex64{7 + 7i, 8 + 8i}, }, - ChannelSub: channelSub, }, + ChannelSub: channelSub, }, }, - Attributes: map[string]interface{}{ - "globalAttr": []int{100, 200, 300}, - }, - IntPointer: &intValue, - StringPointer: &strValue, - MapPointer: &mapValue, - ChannelInt: channelInt, - ChannelStr: channelStr, - ChannelStruct: channelStruct, - SubNode: &SubNode{ - Code: 999, - Data: []*Node{ - { - ID: 4, - Int8Field: int8(38), - Int16Field: int16(316), - Int32Field: int32(332), - Int64Field: int64(364), - UintField: uint(3100), - Uint8Field: uint8(200), - Uint16Field: uint16(3300), - Uint32Field: uint32(3400), - Uint64Field: uint64(3500), - UintptrField: uintptr(3600), - Float32Field: float32(423.456), - Float64Field: 3789.012, - Complex64Field: complex64(4 + 5i), - Complex128Field: complex128(cmplx.Exp(4 + 5i)), - StringField: "GrandChildNode1", - BoolField: false, - Array: [3]int{10, 11, 12}, - Children: []*Node{ - { - ID: 5, - Int8Field: int8(48), - Int16Field: int16(416), - Int32Field: int32(432), - Int64Field: int64(464), - UintField: uint(4100), - Uint8Field: uint8(200), - Uint16Field: uint16(4300), - Uint32Field: uint32(4400), - Uint64Field: uint64(4500), - UintptrField: uintptr(4600), - Float32Field: float32(523.456), - Float64Field: 4789.012, - Complex64Field: complex64(5 + 6i), - Complex128Field: complex128(cmplx.Exp(5 + 6i)), - StringField: "GreatGrandChildNode1", - BoolField: true, - Array: [3]int{13, 14, 15}, - Attributes: map[string]interface{}{ - "greatAttr": "greatValue", - }, - IntPointer: &intValue, - StringPointer: &strValue, - MapPointer: &mapValue, - ChannelInt: channelInt, - ChannelStr: channelStr, - ChannelStruct: channelStruct, + }, + Attributes: map[string]interface{}{ + "globalAttr": []int{100, 200, 300}, + }, + IntPointer: &intValue, + StringPointer: &strValue, + MapPointer: &mapValue, + ChannelInt: channelInt, + ChannelStr: channelStr, + ChannelStruct: channelStruct, + SubNode: &SubNode{ + Code: 999, + Data: []*Node{ + { + ID: 4, + Int8Field: int8(38), + Int16Field: int16(316), + Int32Field: int32(332), + Int64Field: int64(364), + UintField: uint(3100), + Uint8Field: uint8(200), + Uint16Field: uint16(3300), + Uint32Field: uint32(3400), + Uint64Field: uint64(3500), + UintptrField: uintptr(3600), + Float32Field: float32(423.456), + Float64Field: 3789.012, + Complex64Field: complex64(4 + 5i), + Complex128Field: complex128(cmplx.Exp(4 + 5i)), + StringField: "GrandChildNode1", + BoolField: false, + Array: [3]int{10, 11, 12}, + Children: []*Node{ + { + ID: 5, + Int8Field: int8(48), + Int16Field: int16(416), + Int32Field: int32(432), + Int64Field: int64(464), + UintField: uint(4100), + Uint8Field: uint8(200), + Uint16Field: uint16(4300), + Uint32Field: uint32(4400), + Uint64Field: uint64(4500), + UintptrField: uintptr(4600), + Float32Field: float32(523.456), + Float64Field: 4789.012, + Complex64Field: complex64(5 + 6i), + Complex128Field: complex128(cmplx.Exp(5 + 6i)), + StringField: "GreatGrandChildNode1", + BoolField: true, + Array: [3]int{13, 14, 15}, + Attributes: map[string]interface{}{ + "greatAttr": "greatValue", }, + IntPointer: &intValue, + StringPointer: &strValue, + MapPointer: &mapValue, + ChannelInt: channelInt, + ChannelStr: channelStr, + ChannelStruct: channelStruct, }, - Attributes: map[string]interface{}{ - "grandAttr": "grandValue1", - }, - IntPointer: &intValue, - StringPointer: &strValue, - MapPointer: &mapValue, - ChannelInt: channelInt, - ChannelStr: channelStr, - ChannelStruct: channelStruct, }, - { - ID: 6, - Int8Field: int8(58), - Int16Field: int16(516), - Int32Field: int32(532), - Int64Field: int64(564), - UintField: uint(5100), - Uint8Field: uint8(200), - Uint16Field: uint16(5300), - Uint32Field: uint32(5400), - Uint64Field: uint64(5500), - UintptrField: uintptr(5600), - Float32Field: float32(623.456), - Float64Field: 5789.012, - Complex64Field: complex64(6 + 7i), - Complex128Field: complex128(cmplx.Exp(6 + 7i)), - StringField: "GrandChildNode2", - BoolField: true, - Array: [3]int{16, 17, 18}, - Children: []*Node{ - { - ID: 7, - Int8Field: int8(68), - Int16Field: int16(616), - Int32Field: int32(632), - Int64Field: int64(664), - UintField: uint(6100), - Uint8Field: uint8(200), - Uint16Field: uint16(6300), - Uint32Field: uint32(6400), - Uint64Field: uint64(6500), - UintptrField: uintptr(6600), - Float32Field: float32(723.456), - Float64Field: 6789.012, - Complex64Field: complex64(7 + 8i), - Complex128Field: complex128(cmplx.Exp(7 + 8i)), - StringField: "GreatGrandChildNode2", - BoolField: false, - Array: [3]int{19, 20, 21}, - Attributes: map[string]interface{}{ - "greatAttr": "greatValue2", - }, - IntPointer: &intValue, - StringPointer: &strValue, - MapPointer: &mapValue, - ChannelInt: channelInt, - ChannelStr: channelStr, - ChannelStruct: channelStruct, + Attributes: map[string]interface{}{ + "grandAttr": "grandValue1", + }, + IntPointer: &intValue, + StringPointer: &strValue, + MapPointer: &mapValue, + ChannelInt: channelInt, + ChannelStr: channelStr, + ChannelStruct: channelStruct, + }, + { + ID: 6, + Int8Field: int8(58), + Int16Field: int16(516), + Int32Field: int32(532), + Int64Field: int64(564), + UintField: uint(5100), + Uint8Field: uint8(200), + Uint16Field: uint16(5300), + Uint32Field: uint32(5400), + Uint64Field: uint64(5500), + UintptrField: uintptr(5600), + Float32Field: float32(623.456), + Float64Field: 5789.012, + Complex64Field: complex64(6 + 7i), + Complex128Field: complex128(cmplx.Exp(6 + 7i)), + StringField: "GrandChildNode2", + BoolField: true, + Array: [3]int{16, 17, 18}, + Children: []*Node{ + { + ID: 7, + Int8Field: int8(68), + Int16Field: int16(616), + Int32Field: int32(632), + Int64Field: int64(664), + UintField: uint(6100), + Uint8Field: uint8(200), + Uint16Field: uint16(6300), + Uint32Field: uint32(6400), + Uint64Field: uint64(6500), + UintptrField: uintptr(6600), + Float32Field: float32(723.456), + Float64Field: 6789.012, + Complex64Field: complex64(7 + 8i), + Complex128Field: complex128(cmplx.Exp(7 + 8i)), + StringField: "GreatGrandChildNode2", + BoolField: false, + Array: [3]int{19, 20, 21}, + Attributes: map[string]interface{}{ + "greatAttr": "greatValue2", }, + IntPointer: &intValue, + StringPointer: &strValue, + MapPointer: &mapValue, + ChannelInt: channelInt, + ChannelStr: channelStr, + ChannelStruct: channelStruct, }, - Attributes: map[string]interface{}{ - "grandAttr": "grandValue2", - }, - IntPointer: &intValue, - StringPointer: &strValue, - MapPointer: &mapValue, - ChannelInt: channelInt, - ChannelStr: channelStr, - ChannelStruct: channelStruct, }, + Attributes: map[string]interface{}{ + "grandAttr": "grandValue2", + }, + IntPointer: &intValue, + StringPointer: &strValue, + MapPointer: &mapValue, + ChannelInt: channelInt, + ChannelStr: channelStr, + ChannelStruct: channelStruct, }, - ChannelSub: channelSub, - }, - NamedTypes: NamedTypes{ - NamedInt: 99, - NamedFloat: 99.99, - NamedStr: "NamedValue", - NamedMap: map[string]string{"keyA": "valueA"}, }, - CyclicReference: &cyclicNode, - } + ChannelSub: channelSub, + }, + NamedTypes: NamedTypes{ + NamedInt: 99, + NamedFloat: 99.99, + NamedStr: "NamedValue", + NamedMap: map[string]string{"keyA": "valueA"}, + }, + CyclicReference: &cyclicNode, +} +func TestDumperWithComplexDataStructure(t *testing.T) { cyclicNode = root expectedOutput, err := os.ReadFile("./testdata/output.txt") @@ -609,3 +611,38 @@ func TestDumperWithComplexDataStructure(t *testing.T) { } } } + +func TestDumperWithComplexDataStructureAndPrivateFieldsDumpingEnabled(t *testing.T) { + cyclicNode = root + + expectedOutput, err := os.ReadFile("./testdata/private-fields-output.txt") + if err != nil { + t.Fatal(err) + } + + var d dumper + d.dumpPrivateFields = true + d.dump(reflect.ValueOf(root)) + returned := d.buf + + r_lines := bytes.Split(returned, []byte("\n")) + e_lines := bytes.Split(expectedOutput, []byte("\n")) + + if len(r_lines) != len(e_lines) { + t.Fatalf("expected %d lines, got %d", len(e_lines), len(r_lines)) + } + + for i, line := range e_lines { + if len(line) != len(r_lines[i]) { + t.Fatalf(`mismatche at line %d: +--- "%s" ++++ "%s"`, i+1, line, r_lines[i]) + } + + for j, ch := range line { + if ch != r_lines[i][j] { + t.Fatalf(`expected "%c", got "%c" at line %d:%d"`, ch, r_lines[i][j], i+1, j) + } + } + } +} diff --git a/testdata/private-fields-output.txt b/testdata/private-fields-output.txt new file mode 100644 index 0000000..814b518 --- /dev/null +++ b/testdata/private-fields-output.txt @@ -0,0 +1,417 @@ +#1&godump.Node { + ID: 1, + Int8Field: 8, + Int16Field: 16, + Int32Field: 32, + Int64Field: 64, + UintField: 100, + Uint8Field: 200, + Uint16Field: 300, + Uint32Field: 400, + Uint64Field: 500, + UintptrField: 600, + Float32Field: 123.456, + Float64Field: 789.012, + Complex64Field: (1+2i), + Complex128Field: (-1.1312043837568135+2.4717266720048183i), + StringField: "RootNode", + BoolField: true, + Children: []*godump.Node:2:2 { + &godump.Node { + ID: 2, + Int8Field: 18, + Int16Field: 116, + Int32Field: 132, + Int64Field: 164, + UintField: 1100, + Uint8Field: 100, + Uint16Field: 1300, + Uint32Field: 1400, + Uint64Field: 1500, + UintptrField: 1600, + Float32Field: 223.456, + Float64Field: 1789.012, + Complex64Field: (2+3i), + Complex128Field: (-7.315110094901103+1.0427436562359045i), + StringField: "ChildNode1", + BoolField: false, + Children: []*godump.Node:0:0 {}, + Attributes: map[string]interface {}:1 { + "attr": []float64:3:3 { + 1.1, + 2.2, + 3.3, + }, + }, + IntPointer: #3&42, + StringPointer: #4&"example", + MapPointer: #5&map[string]int:1 { + "key1": 1, + }, + ChannelInt: chan int, + ChannelStr: chan string, + ChannelStruct: chan godump.Detail, + Array: [3]int:3:3 { + 4, + 5, + 6, + }, + SubNode: &godump.SubNode { + Code: 100, + Parent: #7&nil, + Data: []*godump.Node:0:0 {}, + SubDetails: []godump.Detail:1:1 { + godump.Detail { + Info: "Detail1", + Count: 1, + Next: &godump.Detail { + Info: "Detail2", + Count: 2, + Next: &@7, + DetailMap: map[string]bool:1 { + "key1": true, + }, + DetailSlice: []complex64:2:2 { + (1+1i), + (2+2i), + }, + }, + DetailMap: map[string]bool:1 { + "key2": false, + }, + DetailSlice: []complex64:2:2 { + (3+3i), + (4+4i), + }, + }, + }, + ChannelSub: chan *godump.SubNode, + }, + privateSubNode: &godump.SubNode { + Code: 100, + Parent: &@7, + Data: []*godump.Node:0:0 {}, + SubDetails: []godump.Detail:1:1 { + godump.Detail { + Info: "Detail1", + Count: 1, + Next: &godump.Detail { + Info: "Detail2", + Count: 2, + Next: &@7, + DetailMap: map[string]bool:1 { + "key1": true, + }, + DetailSlice: []complex64:2:2 { + (1+1i), + (2+2i), + }, + }, + DetailMap: map[string]bool:1 { + "key2": false, + }, + DetailSlice: []complex64:2:2 { + (3+3i), + (4+4i), + }, + }, + }, + ChannelSub: chan *godump.SubNode, + }, + CyclicReference: &@7, + NamedTypes: godump.NamedTypes { + NamedInt: 0, + NamedFloat: 0, + NamedStr: "", + NamedMap: map[string]string:0 {}, + }, + }, + &godump.Node { + ID: 3, + Int8Field: 28, + Int16Field: 216, + Int32Field: 232, + Int64Field: 264, + UintField: 2100, + Uint8Field: 220, + Uint16Field: 2300, + Uint32Field: 2400, + Uint64Field: 2500, + UintptrField: 2600, + Float32Field: 323.456, + Float64Field: 2789.012, + Complex64Field: (3+4i), + Complex128Field: (-13.128783081462158-15.200784463067954i), + StringField: "ChildNode2", + BoolField: true, + Children: []*godump.Node:0:0 {}, + Attributes: map[string]interface {}:1 { + "attr": []string:3:3 { + "a", + "b", + "c", + }, + }, + IntPointer: &@3, + StringPointer: &@4, + MapPointer: &@5, + ChannelInt: chan int, + ChannelStr: chan string, + ChannelStruct: chan godump.Detail, + Array: [3]int:3:3 { + 7, + 8, + 9, + }, + SubNode: &godump.SubNode { + Code: 200, + Parent: &@7, + Data: []*godump.Node:0:0 {}, + SubDetails: []godump.Detail:1:1 { + godump.Detail { + Info: "DetailA", + Count: 10, + Next: &godump.Detail { + Info: "DetailB", + Count: 20, + Next: &@7, + DetailMap: map[string]bool:1 { + "key3": true, + }, + DetailSlice: []complex64:2:2 { + (5+5i), + (6+6i), + }, + }, + DetailMap: map[string]bool:1 { + "key4": false, + }, + DetailSlice: []complex64:2:2 { + (7+7i), + (8+8i), + }, + }, + }, + ChannelSub: chan *godump.SubNode, + }, + privateSubNode: &@7, + CyclicReference: &@7, + NamedTypes: godump.NamedTypes { + NamedInt: 0, + NamedFloat: 0, + NamedStr: "", + NamedMap: map[string]string:0 {}, + }, + }, + }, + Attributes: map[string]interface {}:1 { + "globalAttr": []int:3:3 { + 100, + 200, + 300, + }, + }, + IntPointer: &@3, + StringPointer: &@4, + MapPointer: &@5, + ChannelInt: chan int, + ChannelStr: chan string, + ChannelStruct: chan godump.Detail, + Array: [3]int:3:3 { + 1, + 2, + 3, + }, + SubNode: &godump.SubNode { + Code: 999, + Parent: &@7, + Data: []*godump.Node:2:2 { + &godump.Node { + ID: 4, + Int8Field: 38, + Int16Field: 316, + Int32Field: 332, + Int64Field: 364, + UintField: 3100, + Uint8Field: 200, + Uint16Field: 3300, + Uint32Field: 3400, + Uint64Field: 3500, + UintptrField: 3600, + Float32Field: 423.456, + Float64Field: 3789.012, + Complex64Field: (4+5i), + Complex128Field: (15.487430560650816-52.355491418482046i), + StringField: "GrandChildNode1", + BoolField: false, + Children: []*godump.Node:1:1 { + &godump.Node { + ID: 5, + Int8Field: 48, + Int16Field: 416, + Int32Field: 432, + Int64Field: 464, + UintField: 4100, + Uint8Field: 200, + Uint16Field: 4300, + Uint32Field: 4400, + Uint64Field: 4500, + UintptrField: 4600, + Float32Field: 523.456, + Float64Field: 4789.012, + Complex64Field: (5+6i), + Complex128Field: (142.50190551820737-41.468936789922886i), + StringField: "GreatGrandChildNode1", + BoolField: true, + Children: []*godump.Node:0:0 {}, + Attributes: map[string]interface {}:1 { + "greatAttr": "greatValue", + }, + IntPointer: &@3, + StringPointer: &@4, + MapPointer: &@5, + ChannelInt: chan int, + ChannelStr: chan string, + ChannelStruct: chan godump.Detail, + Array: [3]int:3:3 { + 13, + 14, + 15, + }, + SubNode: &@7, + privateSubNode: &@7, + CyclicReference: &@7, + NamedTypes: godump.NamedTypes { + NamedInt: 0, + NamedFloat: 0, + NamedStr: "", + NamedMap: map[string]string:0 {}, + }, + }, + }, + Attributes: map[string]interface {}:1 { + "grandAttr": "grandValue1", + }, + IntPointer: &@3, + StringPointer: &@4, + MapPointer: &@5, + ChannelInt: chan int, + ChannelStr: chan string, + ChannelStruct: chan godump.Detail, + Array: [3]int:3:3 { + 10, + 11, + 12, + }, + SubNode: &@7, + privateSubNode: &@7, + CyclicReference: &@7, + NamedTypes: godump.NamedTypes { + NamedInt: 0, + NamedFloat: 0, + NamedStr: "", + NamedMap: map[string]string:0 {}, + }, + }, + &godump.Node { + ID: 6, + Int8Field: 58, + Int16Field: 516, + Int32Field: 532, + Int64Field: 564, + UintField: 5100, + Uint8Field: 200, + Uint16Field: 5300, + Uint32Field: 5400, + Uint64Field: 5500, + UintptrField: 5600, + Float32Field: 623.456, + Float64Field: 5789.012, + Complex64Field: (6+7i), + Complex128Field: (304.1458768811725+265.0473108620168i), + StringField: "GrandChildNode2", + BoolField: true, + Children: []*godump.Node:1:1 { + &godump.Node { + ID: 7, + Int8Field: 68, + Int16Field: 616, + Int32Field: 632, + Int64Field: 664, + UintField: 6100, + Uint8Field: 200, + Uint16Field: 6300, + Uint32Field: 6400, + Uint64Field: 6500, + UintptrField: 6600, + Float32Field: 723.456, + Float64Field: 6789.012, + Complex64Field: (7+8i), + Complex128Field: (-159.56016162698737+1084.963058811841i), + StringField: "GreatGrandChildNode2", + BoolField: false, + Children: []*godump.Node:0:0 {}, + Attributes: map[string]interface {}:1 { + "greatAttr": "greatValue2", + }, + IntPointer: &@3, + StringPointer: &@4, + MapPointer: &@5, + ChannelInt: chan int, + ChannelStr: chan string, + ChannelStruct: chan godump.Detail, + Array: [3]int:3:3 { + 19, + 20, + 21, + }, + SubNode: &@7, + privateSubNode: &@7, + CyclicReference: &@7, + NamedTypes: godump.NamedTypes { + NamedInt: 0, + NamedFloat: 0, + NamedStr: "", + NamedMap: map[string]string:0 {}, + }, + }, + }, + Attributes: map[string]interface {}:1 { + "grandAttr": "grandValue2", + }, + IntPointer: &@3, + StringPointer: &@4, + MapPointer: &@5, + ChannelInt: chan int, + ChannelStr: chan string, + ChannelStruct: chan godump.Detail, + Array: [3]int:3:3 { + 16, + 17, + 18, + }, + SubNode: &@7, + privateSubNode: &@7, + CyclicReference: &@7, + NamedTypes: godump.NamedTypes { + NamedInt: 0, + NamedFloat: 0, + NamedStr: "", + NamedMap: map[string]string:0 {}, + }, + }, + }, + SubDetails: []godump.Detail:0:0 {}, + ChannelSub: chan *godump.SubNode, + }, + privateSubNode: &@7, + CyclicReference: &&@1, + NamedTypes: godump.NamedTypes { + NamedInt: 99, + NamedFloat: 99.99, + NamedStr: "NamedValue", + NamedMap: map[string]string:1 { + "keyA": "valueA", + }, + }, +} \ No newline at end of file