summaryrefslogtreecommitdiff
path: root/spew/internal_test.go
diff options
context:
space:
mode:
authorDave Collins <[email protected]>2014-10-24 18:49:38 -0500
committerDave Collins <[email protected]>2014-10-24 18:49:38 -0500
commit128854244a4ac24b718da3d5f79cf5541c81ee56 (patch)
treec00dd22759687c6f28244a1768c0549228cc8a78 /spew/internal_test.go
parent3fdaf5cea8d23107b993d363e98992fa529dd713 (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 82f48826c6c7 as well as the internal reflect.Value flag bit changes as of golang commit 90a7c3c86944. It accomplishes this by doing some inspection at init time and choosing the appropriate offsets and flag positions accordingly. There was some previous logic which dealt with a similar issue for golang commit ecccf07e7f9d. However, since the more recent commits essentially reverted the change and also modify the flag bit positions, it made more sense to rework the detection logic. In particular, the new logic examines the size of the reflect.Value struct to determine the difference and extracts the kind from the flags to determine if the flags have been changed. As a result, this commit allows spew to work properly with tip all the back to Go 1.0.
Diffstat (limited to 'spew/internal_test.go')
-rw-r--r--spew/internal_test.go6
1 files changed, 0 insertions, 6 deletions
diff --git a/spew/internal_test.go b/spew/internal_test.go
index faac638..10dc0b1 100644
--- a/spew/internal_test.go
+++ b/spew/internal_test.go
@@ -81,12 +81,6 @@ func TestInvalidReflectValue(t *testing.T) {
}
}
-// flagRO, flagKindShift and flagKindWidth indicate various bit flags that the
-// reflect package uses internally to track kind and state information.
-const flagRO = 1 << 0
-const flagKindShift = 4
-const flagKindWidth = 5
-
// changeKind uses unsafe to intentionally change the kind of a reflect.Value to
// the maximum kind value which does not exist. This is needed to test the
// fallback code which punts to the standard fmt library for new types that