summaryrefslogtreecommitdiff
path: root/src/pkg/encoding/gob/type.go
diff options
context:
space:
mode:
authorAndrew Gerrand <adg@golang.org>2013-11-18 12:40:00 +1100
committerAndrew Gerrand <adg@golang.org>2013-11-18 12:40:00 +1100
commit93cca4df034390e56030a454103324ed255e0457 (patch)
treea5b3c0a4e5a88c6320681492f367d61a4abd3c7e /src/pkg/encoding/gob/type.go
parentc5cada7b2685bb1321a033883a7b82c5dc0a47f7 (diff)
downloadgo-93cca4df034390e56030a454103324ed255e0457.tar.gz
[release-branch.go1.2] encoding/gob: do not use MarshalText, UnmarshalText
??? CL 22770044 / 23fc3139589c encoding/gob: do not use MarshalText, UnmarshalText This seems to be the best of a long list of bad ways to fix this issue. Fixes issue 6760. R=r CC=golang-dev https://codereview.appspot.com/22770044 ??? R=golang-dev CC=golang-dev https://codereview.appspot.com/28110043
Diffstat (limited to 'src/pkg/encoding/gob/type.go')
-rw-r--r--src/pkg/encoding/gob/type.go15
1 files changed, 11 insertions, 4 deletions
diff --git a/src/pkg/encoding/gob/type.go b/src/pkg/encoding/gob/type.go
index 65bf17b7f..cad145279 100644
--- a/src/pkg/encoding/gob/type.go
+++ b/src/pkg/encoding/gob/type.go
@@ -88,18 +88,25 @@ func validUserType(rt reflect.Type) (ut *userTypeInfo, err error) {
ut.externalEnc, ut.encIndir = xGob, indir
} else if ok, indir := implementsInterface(ut.user, binaryMarshalerInterfaceType); ok {
ut.externalEnc, ut.encIndir = xBinary, indir
- } else if ok, indir := implementsInterface(ut.user, textMarshalerInterfaceType); ok {
- ut.externalEnc, ut.encIndir = xText, indir
}
+ // NOTE(rsc): Would like to allow MarshalText here, but results in incompatibility
+ // with older encodings for net.IP. See golang.org/issue/6760.
+ // } else if ok, indir := implementsInterface(ut.user, textMarshalerInterfaceType); ok {
+ // ut.externalEnc, ut.encIndir = xText, indir
+ // }
+
if ok, indir := implementsInterface(ut.user, gobDecoderInterfaceType); ok {
ut.externalDec, ut.decIndir = xGob, indir
} else if ok, indir := implementsInterface(ut.user, binaryUnmarshalerInterfaceType); ok {
ut.externalDec, ut.decIndir = xBinary, indir
- } else if ok, indir := implementsInterface(ut.user, textUnmarshalerInterfaceType); ok {
- ut.externalDec, ut.decIndir = xText, indir
}
+ // See note above.
+ // } else if ok, indir := implementsInterface(ut.user, textUnmarshalerInterfaceType); ok {
+ // ut.externalDec, ut.decIndir = xText, indir
+ // }
+
userTypeCache[rt] = ut
return
}