|
N13m3y3r |
at Aug 31, 2012 at 9:26 pm
|
⇧ |
| |
Thanks for handling this Russ. Just a couple of questions:
http://codereview.appspot.com/6460044/diff/4001/src/pkg/encoding/json/decode.goFile src/pkg/encoding/json/decode.go (right):
http://codereview.appspot.com/6460044/diff/4001/src/pkg/encoding/json/decode.go#newcode504src/pkg/encoding/json/decode.go:504: if strings.EqualFold(ff.name, key)
{
This is now picking the last match rather than the first one. Is this
ok? No tests seem to cover this either.
http://codereview.appspot.com/6460044/diff/4001/src/pkg/encoding/json/encode.goFile src/pkg/encoding/json/encode.go (right):
http://codereview.appspot.com/6460044/diff/4001/src/pkg/encoding/json/encode.go#newcode89src/pkg/encoding/json/encode.go:89: // An anonymous struct field with a
name given in its JSON tag is treated as
That's nice.
http://codereview.appspot.com/6460044/diff/4001/src/pkg/encoding/json/encode.go#newcode594src/pkg/encoding/json/encode.go:594: current, next = next, current[:0]
Clever reuse.
http://codereview.appspot.com/6460044/diff/4001/src/pkg/encoding/json/encode.go#newcode628src/pkg/encoding/json/encode.go:628: if count[f.typ] > 1 {
// Force a name collision.
Is that the idea? The index information is of course not correct for
the multiple fields, so it's a bit surprising on first sight.
It'd also be nice to have a test that breaks when this is commented out.
Right now we can take all of the count logic out and tests still pass.
http://codereview.appspot.com/6460044/diff/4001/src/pkg/encoding/json/encode.go#newcode636src/pkg/encoding/json/encode.go:636: if ft.Name() == "" {
// Must be a pointer.
http://codereview.appspot.com/6460044/