diff options
| author | Daniel Martà <mvdan@mvdan.cc> | 2020-07-01 11:31:15 +0000 |
|---|---|---|
| committer | Daniel Martà <mvdan@mvdan.cc> | 2020-07-02 22:08:11 +0000 |
| commit | 5de90d33c837af4d9a375a0a36811c7033655596 (patch) | |
| tree | d034eb8de25b4c60e5db4741b159462af655fe32 /src/encoding/json/decode_test.go | |
| parent | a4ba411b19fa0111a3c8fe059fcf5489d3bd6bbf (diff) | |
| download | go-5de90d33c837af4d9a375a0a36811c7033655596.tar.xz | |
Revert "encoding/json: don't reuse slice elements when decoding"
This reverts https://golang.org/cl/191783.
Reason for revert: Broke too many programs which depended on the previous
behavior, even when it was the opposite of what the documentation said.
We can attempt to fix the original issue again for 1.16, while keeping
those programs in mind.
Fixes #39427.
Change-Id: I7a7f24b2a594c597ef625aeff04fff29aaa88fc6
Reviewed-on: https://go-review.googlesource.com/c/go/+/240657
Run-TryBot: Dmitri Shuralyov <dmitshur@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Emmanuel Odeke <emm.odeke@gmail.com>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Diffstat (limited to 'src/encoding/json/decode_test.go')
| -rw-r--r-- | src/encoding/json/decode_test.go | 15 |
1 files changed, 1 insertions, 14 deletions
diff --git a/src/encoding/json/decode_test.go b/src/encoding/json/decode_test.go index 2728c8ee50..219e845c7b 100644 --- a/src/encoding/json/decode_test.go +++ b/src/encoding/json/decode_test.go @@ -2099,10 +2099,7 @@ func TestSkipArrayObjects(t *testing.T) { // slices, and arrays. // Issues 4900 and 8837, among others. func TestPrefilled(t *testing.T) { - type T struct { - A, B int - } - // Values here change, cannot reuse the table across runs. + // Values here change, cannot reuse table across runs. var prefillTests = []struct { in string ptr interface{} @@ -2138,16 +2135,6 @@ func TestPrefilled(t *testing.T) { ptr: &[...]int{1, 2}, out: &[...]int{3, 0}, }, - { - in: `[{"A": 3}]`, - ptr: &[]T{{A: -1, B: -2}, {A: -3, B: -4}}, - out: &[]T{{A: 3}}, - }, - { - in: `[{"A": 3}]`, - ptr: &[...]T{{A: -1, B: -2}, {A: -3, B: -4}}, - out: &[...]T{{A: 3, B: -2}, {}}, - }, } for _, tt := range prefillTests { |
