Skip to content

Commit

Permalink
improve pointer sign
Browse files Browse the repository at this point in the history
  • Loading branch information
yassinebenaid committed Jun 11, 2024
1 parent 39e72c6 commit 0bd8343
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
6 changes: 3 additions & 3 deletions dumper.go
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,9 @@ func (d *dumper) dumpPointer(v reflect.Value) {
elem := v.Elem()

if isPrimitive(elem) {
d.write(d.theme.PointerSign.apply("&"))
if elem.IsValid() {
d.write(d.theme.PointerSign.apply("&"))
}
d.dump(elem, true)
return
}
Expand Down Expand Up @@ -214,8 +216,6 @@ func isPrimitive(val reflect.Value) bool {
case reflect.Pointer:
v = v.Elem()
default:
fmt.Println(v.Kind())

return false
}
}
Expand Down
2 changes: 1 addition & 1 deletion testdata/primitives.txt
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ godump.Node {
PtrTypedBool2: &false,
PtrTypedString: &"foo bar",
PtrTypedUintptr: &0x499602d2,
Nil: &nil,
Nil: nil,
Func: func(),
Func2: func(int) float64,
Func3: func(...*interface {}) interface {},
Expand Down

0 comments on commit 0bd8343

Please sign in to comment.