Closed AlekSi closed 10 years ago
This is a reasonable request. I haven't spent much time dealing with cgo types under reflection, so I'm not sure how much is possible, but I'll take a look.
After looking into this a bit tonight, I see that C.char is considered signed as an int8 under reflection. As a result, the hexdump style functionality is bypassed since it only works with uint8.
There are a couple of ways to handle this. One way is to allow spew to hexdump int8 slices as well as uint8 slices, but I don't think that's really desirable for most cases. Another option that is a bit hackish is to look at the textual type (versus the reflected type) specifically to detect something like the pattern ^.*\._Ctype_char$
and hexdump it from there after a bit of casting.
Any thoughts?
I think looking for ^.*\._Ctype_char$
is okay if user is opted in for it.
This feature, including new tests and an updated test coverage report has been implemented as of commit 1fe9f5ca4b46a8247ae5939097f5cfc5d8370729.
This can be made smaller: