summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--spew/bypass.go15
-rw-r--r--spew/dump.go2
2 files changed, 15 insertions, 2 deletions
diff --git a/spew/bypass.go b/spew/bypass.go
index a8d27a3..565bf58 100644
--- a/spew/bypass.go
+++ b/spew/bypass.go
@@ -91,6 +91,21 @@ func init() {
flagKindShift = 0
flagRO = 1 << 5
flagIndir = 1 << 6
+
+ // Commit adf9b30e5594 modified the flags to separate the
+ // flagRO flag into two bits which specifies whether or not the
+ // field is embedded. This causes flagIndir to move over a bit
+ // and means that flagRO is the combination of either of the
+ // original flagRO bit and the new bit.
+ //
+ // This code detects the change by extracting what used to be
+ // the indirect bit to ensure it's set. When it's not, the flag
+ // order has been changed to the newer format, so the flags are
+ // updated accordingly.
+ if upfv&flagIndir == 0 {
+ flagRO = 3 << 5
+ flagIndir = 1 << 7
+ }
}
}
diff --git a/spew/dump.go b/spew/dump.go
index 36a2b6c..a0ff95e 100644
--- a/spew/dump.go
+++ b/spew/dump.go
@@ -181,8 +181,6 @@ func (d *dumpState) dumpSlice(v reflect.Value) {
// Try to use existing uint8 slices and fall back to converting
// and copying if that fails.
case vt.Kind() == reflect.Uint8:
- // TODO(davec): Fix up the disableUnsafe bits...
-
// We need an addressable interface to convert the type
// to a byte slice. However, the reflect package won't
// give us an interface on certain things like