Skip to content

Commit

Permalink
utter: improve non-pointer cycle rendering
Browse files Browse the repository at this point in the history
This makes it consistent with the pointer case.
  • Loading branch information
kortschak committed Aug 27, 2021
1 parent 8289a1b commit 2c357d3
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
12 changes: 6 additions & 6 deletions dump.go
Original file line number Diff line number Diff line change
Expand Up @@ -89,10 +89,10 @@ func (d *dumpState) unpackValue(v reflect.Value) (val reflect.Value, wasPtr, sta

// dumpPtr handles formatting of pointers by indirecting them as necessary.
func (d *dumpState) dumpPtr(v reflect.Value) {
// Remove pointers at or below the current depth from map used to detect
// Remove pointers below the current depth from map used to detect
// circular refs.
for k, depth := range d.pointers {
if depth >= d.depth {
if depth > d.depth {
delete(d.pointers, k)
}
}
Expand Down Expand Up @@ -438,10 +438,10 @@ func (d *dumpState) dump(v reflect.Value, wasPtr, static bool, addr uintptr) {
d.dumpSlice(v)
break
}
// Remove pointers at or below the current depth from map used to detect
// Remove pointers below the current depth from map used to detect
// circular refs.
for k, depth := range d.pointers {
if depth >= d.depth {
if depth > d.depth {
delete(d.pointers, k)
}
}
Expand Down Expand Up @@ -480,10 +480,10 @@ func (d *dumpState) dump(v reflect.Value, wasPtr, static bool, addr uintptr) {
break
}

// Remove pointers at or below the current depth from map used to detect
// Remove pointers below the current depth from map used to detect
// circular refs.
for k, depth := range d.pointers {
if depth >= d.depth {
if depth > d.depth {
delete(d.pointers, k)
}
}
Expand Down
4 changes: 2 additions & 2 deletions dump_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1019,7 +1019,7 @@ var sliceElementCycles = []struct {
return &r
}(),
want: `&[]interface{}{
&[]interface{}(<already shown>),
(*[]interface{})(<already shown>),
}
`,
},
Expand Down Expand Up @@ -1131,7 +1131,7 @@ var mapElementCycles = []struct {
return &r
}(),
want: `&map[int]interface{}{
int(0): &map[int]interface{}(<already shown>),
int(0): (*map[int]interface{})(<already shown>),
}
`,
},
Expand Down

0 comments on commit 2c357d3

Please sign in to comment.