]> Cypherpunks repositories - gostls13.git/commit
[release-branch.go1.8] encoding/xml: fix incorrect indirect code in chardata, comment...
authorRuss Cox <rsc@golang.org>
Tue, 14 Feb 2017 05:17:50 +0000 (00:17 -0500)
committerRuss Cox <rsc@golang.org>
Wed, 15 Feb 2017 14:31:02 +0000 (14:31 +0000)
commitcedc511a6e71f1ac12835da3bb08b96e1dd69b2e
tree55267d734a79a665e5c2bb28cc91664ff2143247
parentae13ccfd6dee7113d11aba0c1c287bfa2897488d
[release-branch.go1.8] encoding/xml: fix incorrect indirect code in chardata, comment, innerxml fields

The new tests in this CL have been checked against Go 1.7 as well
and all pass in Go 1.7, with the one exception noted in a comment
(an intentional change to omitempty already present before this CL).

CL 15684 made the intentional change to omitempty.
This CL fixes bugs introduced along the way.

Most of these are corner cases that are arguably not that important,
but they've always worked all the way back to Go 1, and someone
cared enough to file #19063. The most significant problem found
while adding tests is that in the case of a nil *string field with
`xml:",chardata"`, the existing code silently stops processing not just
that field but the entire remainder of the struct.
Even if #19063 were not worth fixing, this chardata bug would be.

Fixes #19063.

Change-Id: I318cf8f9945e1a4615982d9904e109fde577ebf9
Reviewed-on: https://go-review.googlesource.com/36954
Run-TryBot: Russ Cox <rsc@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Daniel Martí <mvdan@mvdan.cc>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
(cherry picked from commit 72aa757dddad7e915f4faad87aacf8010d91561b)
Reviewed-on: https://go-review.googlesource.com/37016
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Russ Cox <rsc@golang.org>
src/encoding/xml/marshal.go
src/encoding/xml/marshal_test.go