Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(5)

Issue 3889043: code review 3889043: gob: do not encode or decode unexported fields (Closed)

Can't Edit
Can't Publish+Mail
Start Review
Created:
14 years, 3 months ago by r
Modified:
14 years, 3 months ago
Reviewers:
CC:
rsc, r2, golang-dev
Visibility:
Public.

Description

gob: do not encode or decode unexported fields Such fields are simply ignored.

Patch Set 1 #

Total comments: 3

Patch Set 2 : code review 3889043: gob: do not encode or decode unexported fields #

Unified diffs Side-by-side diffs Delta from patch set Stats (+457 lines, -407 lines) Patch
M src/pkg/gob/codec_test.go View 1 16 chunks +258 lines, -228 lines 0 comments Download
M src/pkg/gob/debug.go View 5 chunks +33 lines, -33 lines 0 comments Download
M src/pkg/gob/decode.go View 10 chunks +42 lines, -31 lines 0 comments Download
M src/pkg/gob/doc.go View 1 2 chunks +26 lines, -23 lines 0 comments Download
M src/pkg/gob/encode.go View 1 2 chunks +6 lines, -0 lines 0 comments Download
M src/pkg/gob/encoder_test.go View 8 chunks +34 lines, -34 lines 0 comments Download
M src/pkg/gob/type.go View 14 chunks +58 lines, -58 lines 0 comments Download

Messages

Total messages: 6
r
Hello rsc (cc: golang-dev@googlegroups.com), I'd like you to review this change.
14 years, 3 months ago (2011-01-11 21:17:39 UTC) #1
rsc1
LGTM http://codereview.appspot.com/3889043/diff/1/src/pkg/gob/codec_test.go File src/pkg/gob/codec_test.go (right): http://codereview.appspot.com/3889043/diff/1/src/pkg/gob/codec_test.go#newcode1340 src/pkg/gob/codec_test.go:1340: if u1.c == u0.c { u1.c != 0 ...
14 years, 3 months ago (2011-01-11 21:28:30 UTC) #2
r2
> > http://codereview.appspot.com/3889043/diff/1/src/pkg/gob/encode.go#newcode545 > src/pkg/gob/encode.go:545: op = nil > would be nice if this were ...
14 years, 3 months ago (2011-01-11 21:33:34 UTC) #3
rsc
>> would be nice if this were "continue" >> I'm not sure that fieldnum has ...
14 years, 3 months ago (2011-01-11 21:43:44 UTC) #4
r
*** Submitted as http://code.google.com/p/go/source/detail?r=0b072b98fa1b *** gob: do not encode or decode unexported fields Such fields ...
14 years, 3 months ago (2011-01-11 21:44:02 UTC) #5
r2
14 years, 3 months ago (2011-01-11 21:45:22 UTC) #6
On Jan 11, 2011, at 1:43 PM, Russ Cox wrote:

>>> would be nice if this were "continue"
>>> I'm not sure that fieldnum has to match the reflect struct type field
>>> numbers.
>> 
>> in fact they do. that's how the encode machine iterates.
> 
> right now encodeStruct skips over the fields with instr.op == nil.
> i can't see that they get used anywhere else.
> i think it's just historical that gob fieldnum == reflect fieldnum
> in the implementation.  once the encode machine is built
> i don't think it refers to reflect data structures at all.

the == nil was a recent addition to maintain this fiction. i changed the code to
introduce a noop encoder and got rid of the nil.

but i investigate another approach.

-rob

Sign in to reply to this message.

Powered by Google App Engine
RSS Feeds Recent Issues | This issue
This is Rietveld f62528b