Skip to content

Commit

Permalink
Remove Unnecessary boilerplate
Browse files Browse the repository at this point in the history
  • Loading branch information
yassinebenaid authored Aug 28, 2024
1 parent 1bd0468 commit 35c3e2a
Showing 1 changed file with 6 additions and 10 deletions.
16 changes: 6 additions & 10 deletions dumper.go
Original file line number Diff line number Diff line change
Expand Up @@ -222,16 +222,12 @@ func (d *Dumper) dump(val reflect.Value, ignoreDepth ...bool) {
case reflect.Interface:
d.dump(val.Elem(), true)
case reflect.UnsafePointer:
if t := val.Type(); t.PkgPath() != "" {
d.buf.WriteString(
__(d.Theme.Types, t.String()) +
__(d.Theme.Braces, "(") +
__(d.Theme.UnsafePointer, fmt.Sprintf("0x%x", uintptr(val.UnsafePointer()))) +
__(d.Theme.Braces, ")"),
)
} else {
d.buf.WriteString(__(d.Theme.UnsafePointer, fmt.Sprintf("unsafe.Pointer(0x%x)", uintptr(val.UnsafePointer()))))
}
d.buf.WriteString(
__(d.Theme.Types, val.Type().String()) +
__(d.Theme.Braces, "(") +
__(d.Theme.UnsafePointer, fmt.Sprintf("0x%x", uintptr(val.UnsafePointer()))) +
__(d.Theme.Braces, ")"),
)
}
}

Expand Down

0 comments on commit 35c3e2a

Please sign in to comment.