diff options
| author | Dave Collins <[email protected]> | 2014-01-08 02:01:15 -0600 |
|---|---|---|
| committer | Dave Collins <[email protected]> | 2014-01-08 02:01:15 -0600 |
| commit | 65ca732a33a40c2a5b9e036f236f975e7e85cf6c (patch) | |
| tree | cb777cc3c5765ea4aa0a552c9e768246c5381da2 /spew/internal_test.go | |
| parent | bde46cf02b3187ab268e4d0e10a0c361dc39112c (diff) | |
Add logic to deal with reflect pkg changes on tip.
This commit adds logic to gracefully handle the new internal reflect.Value
structure on tip as of golang commit ecccf07e7f9d. It accomplishes this
by doing some inspection at init time and choosing the appropriate offsets
as well as modifying which offset is used for the value accordingly. As a
result, this allows spew to work properly with both the current release
version of Go as well as tip.
Fixes #15.
Diffstat (limited to 'spew/internal_test.go')
| -rw-r--r-- | spew/internal_test.go | 3 |
1 files changed, 1 insertions, 2 deletions
diff --git a/spew/internal_test.go b/spew/internal_test.go index d8c9761..faac638 100644 --- a/spew/internal_test.go +++ b/spew/internal_test.go @@ -92,8 +92,7 @@ const flagKindWidth = 5 // fallback code which punts to the standard fmt library for new types that // might get added to the language. func changeKind(v *reflect.Value, readOnly bool) { - rvf := (*uintptr)(unsafe.Pointer(uintptr(unsafe.Pointer(v)) + - unsafe.Offsetof(reflectValue.flag))) + rvf := (*uintptr)(unsafe.Pointer(uintptr(unsafe.Pointer(v)) + offsetFlag)) *rvf = *rvf | ((1<<flagKindWidth - 1) << flagKindShift) if readOnly { *rvf |= flagRO |
