[go] encoding/json: fix invalid kind reflect type

111 views
Skip to first unread message

Meng Zhuo (Gerrit)

unread,
Dec 16, 2020, 7:52:52 AM12/16/20
to goph...@pubsubhelper.golang.org, Meng Zhuo, golang-co...@googlegroups.com

Meng Zhuo has uploaded this change for review.

View Change

encoding/json: fix invalid kind reflect type

If an invalid value kind calling value type will raise panic which
should not happend.
However it's possible that value implements MarshalText calling by
stringEncoder doesn't check on value kind.

Fixes #43207

Change-Id: If4bc55229b1f64b8ca4b0fed37549725efdace39
---
M src/encoding/json/encode.go
M src/encoding/json/encode_test.go
2 files changed, 18 insertions(+), 0 deletions(-)

diff --git a/src/encoding/json/encode.go b/src/encoding/json/encode.go
index 483b9d8..cc3e58a 100644
--- a/src/encoding/json/encode.go
+++ b/src/encoding/json/encode.go
@@ -617,6 +617,10 @@
)

func stringEncoder(e *encodeState, v reflect.Value, opts encOpts) {
+ if v.Kind() == reflect.Invalid {
+ e.error(fmt.Errorf("json: invalid kind %q", v))
+ return
+ }
if v.Type() == numberType {
numStr := v.String()
// In Go1.5 the empty string encodes to "0", while this is not a valid number literal
diff --git a/src/encoding/json/encode_test.go b/src/encoding/json/encode_test.go
index 42bb09d..c350a45 100644
--- a/src/encoding/json/encode_test.go
+++ b/src/encoding/json/encode_test.go
@@ -245,6 +245,15 @@
}
}

+// Issue 43207
+func TestUnsupportedKind(t *testing.T) {
+ m := map[textfloat]string{textfloat(math.NaN()): "NaN"}
+ d, err := Marshal(m)
+ if err == nil {
+ t.Errorf("expect err, got nil, d=%s", string(d))
+ }
+}
+
// Ref has Marshaler and Unmarshaler methods with pointer receiver.
type Ref int

@@ -854,6 +863,10 @@
return buf.Bytes(), nil
}

+type textfloat float64
+
+func (f textfloat) MarshalText() ([]byte, error) { return tenc(`TF:%0.2f`, f) }
+
// Issue 13783
func TestEncodeBytekind(t *testing.T) {
testdata := []struct {
@@ -872,6 +885,7 @@
{[]jsonint{5, 4}, `[{"JI":5},{"JI":4}]`},
{[]textint{9, 3}, `["TI:9","TI:3"]`},
{[]int{9, 3}, `[9,3]`},
+ {[]textfloat{12, 3}, `["TF:12.00","TF:3.00"]`},
}
for _, d := range testdata {
js, err := Marshal(d.data)

To view, visit change 278632. To unsubscribe, or for help writing mail filters, visit settings.

Gerrit-Project: go
Gerrit-Branch: master
Gerrit-Change-Id: If4bc55229b1f64b8ca4b0fed37549725efdace39
Gerrit-Change-Number: 278632
Gerrit-PatchSet: 1
Gerrit-Owner: Meng Zhuo <m...@golangcn.org>
Gerrit-Reviewer: Meng Zhuo <m...@golangcn.org>
Gerrit-MessageType: newchange

Cuong Manh Le (Gerrit)

unread,
Dec 16, 2020, 8:12:34 AM12/16/20
to Meng Zhuo, goph...@pubsubhelper.golang.org, golang-co...@googlegroups.com

Attention is currently required from: Meng Zhuo.

Patch set 1:Run-TryBot +1

View Change

    To view, visit change 278632. To unsubscribe, or for help writing mail filters, visit settings.

    Gerrit-Project: go
    Gerrit-Branch: master
    Gerrit-Change-Id: If4bc55229b1f64b8ca4b0fed37549725efdace39
    Gerrit-Change-Number: 278632
    Gerrit-PatchSet: 1
    Gerrit-Owner: Meng Zhuo <m...@golangcn.org>
    Gerrit-Reviewer: Cuong Manh Le <cuong.m...@gmail.com>
    Gerrit-Reviewer: Meng Zhuo <m...@golangcn.org>
    Gerrit-Attention: Meng Zhuo <m...@golangcn.org>
    Gerrit-Comment-Date: Wed, 16 Dec 2020 13:12:27 +0000
    Gerrit-HasComments: No
    Gerrit-Has-Labels: Yes
    Gerrit-MessageType: comment

    Bryan C. Mills (Gerrit)

    unread,
    Dec 16, 2020, 10:38:39 AM12/16/20
    to Meng Zhuo, goph...@pubsubhelper.golang.org, Bryan C. Mills, Go Bot, Cuong Manh Le, golang-co...@googlegroups.com

    Attention is currently required from: Meng Zhuo.

    View Change

    1 comment:

    To view, visit change 278632. To unsubscribe, or for help writing mail filters, visit settings.

    Gerrit-Project: go
    Gerrit-Branch: master
    Gerrit-Change-Id: If4bc55229b1f64b8ca4b0fed37549725efdace39
    Gerrit-Change-Number: 278632
    Gerrit-PatchSet: 1
    Gerrit-Owner: Meng Zhuo <m...@golangcn.org>
    Gerrit-Reviewer: Cuong Manh Le <cuong.m...@gmail.com>
    Gerrit-Reviewer: Go Bot <go...@golang.org>
    Gerrit-Reviewer: Meng Zhuo <m...@golangcn.org>
    Gerrit-CC: Bryan C. Mills <bcm...@google.com>
    Gerrit-Attention: Meng Zhuo <m...@golangcn.org>
    Gerrit-Comment-Date: Wed, 16 Dec 2020 15:38:33 +0000
    Gerrit-HasComments: Yes
    Gerrit-Has-Labels: No
    Gerrit-MessageType: comment

    Meng Zhuo (Gerrit)

    unread,
    Dec 17, 2020, 3:02:47 AM12/17/20
    to Meng Zhuo, Go Bot, Cuong Manh Le, goph...@pubsubhelper.golang.org, Bryan C. Mills, golang-co...@googlegroups.com

    Attention is currently required from: Meng Zhuo.

    Meng Zhuo uploaded patch set #2 to this change.

    View Change

    encoding/json: MarshalMap by iteration

    The MarshalMap using MapIndex for accessing map value,
    Unfortunately it's invalid when underlying type is unsupported but type
    has implemented MarshalText interface. i.e.

    type A float64
    m :=map[A]int{math.NaN(): 1}

    As JSON spec(rfc7159) doesn't specified on duplicate objects, we can
    encode map with duplicate object with some performance improvement.

    name old time/op new time/op delta
    MarshalMap/Item=32 0.00ns ±24% 0.00ns ±21% -11.18% (p=0.018 n=9+9)
    MarshalMap/Item=64 0.00ns ± 8% 0.00ns ± 8% -8.00% (p=0.002 n=10+10)
    MarshalMap/Item=128 0.00ns ± 4% 0.00ns ±20% -8.31% (p=0.010 n=9+9)
    MarshalMap/Item=256 0.00ns ± 3% 0.00ns ± 3% -9.28% (p=0.000 n=10+10)
    MarshalMap/Item=512 0.00ns ± 1% 0.00ns ±10% -6.59% (p=0.005 n=8+10)
    MarshalMap/Item=1024 0.00ns ± 2% 0.00ns ± 4% -8.53% (p=0.000 n=9+9)
    MarshalMap/Item=2048 0.00ns ± 2% 0.00ns ± 2% -8.29% (p=0.000 n=9+8)
    MarshalMap/Item=4096 0.00ns ± 7% 0.00ns ± 2% -8.82% (p=0.000 n=9+10)

    name old alloc/op new alloc/op delta
    MarshalMap/Item=32 0.00B 0.00B ~ (all equal)
    MarshalMap/Item=64 0.00B 0.00B ~ (all equal)
    MarshalMap/Item=128 0.00B 0.00B ~ (all equal)
    MarshalMap/Item=256 0.00B 0.00B ~ (all equal)
    MarshalMap/Item=512 0.00B 0.00B ~ (all equal)
    MarshalMap/Item=1024 0.00B 0.00B ~ (all equal)
    MarshalMap/Item=2048 0.00B 0.00B ~ (all equal)
    MarshalMap/Item=4096 0.00B 0.00B ~ (all equal)

    name old allocs/op new allocs/op delta
    MarshalMap/Item=32 0.00 0.00 ~ (all equal)
    MarshalMap/Item=64 0.00 0.00 ~ (all equal)
    MarshalMap/Item=128 0.00 0.00 ~ (all equal)
    MarshalMap/Item=256 0.00 0.00 ~ (all equal)
    MarshalMap/Item=512 0.00 0.00 ~ (all equal)
    MarshalMap/Item=1024 0.00 0.00 ~ (all equal)
    MarshalMap/Item=2048 0.00 0.00 ~ (all equal)
    MarshalMap/Item=4096 0.00 0.00 ~ (all equal)


    Fixes #43207

    Change-Id: If4bc55229b1f64b8ca4b0fed37549725efdace39
    ---
    M src/encoding/json/bench_test.go
    M src/encoding/json/encode.go
    M src/encoding/json/encode_test.go
    3 files changed, 57 insertions(+), 18 deletions(-)

    To view, visit change 278632. To unsubscribe, or for help writing mail filters, visit settings.

    Gerrit-Project: go
    Gerrit-Branch: master
    Gerrit-Change-Id: If4bc55229b1f64b8ca4b0fed37549725efdace39
    Gerrit-Change-Number: 278632
    Gerrit-PatchSet: 2
    Gerrit-Owner: Meng Zhuo <m...@golangcn.org>
    Gerrit-Reviewer: Cuong Manh Le <cuong.m...@gmail.com>
    Gerrit-Reviewer: Go Bot <go...@golang.org>
    Gerrit-Reviewer: Meng Zhuo <m...@golangcn.org>
    Gerrit-CC: Bryan C. Mills <bcm...@google.com>
    Gerrit-Attention: Meng Zhuo <m...@golangcn.org>
    Gerrit-MessageType: newpatchset

    Meng Zhuo (Gerrit)

    unread,
    Dec 17, 2020, 3:03:57 AM12/17/20
    to Meng Zhuo, goph...@pubsubhelper.golang.org, Bryan C. Mills, Go Bot, Cuong Manh Le, golang-co...@googlegroups.com

    Attention is currently required from: Bryan C. Mills.

    Patch set 2:Run-TryBot +1

    View Change

    1 comment:

    • File src/encoding/json/encode_test.go:

      • Since textfloat implements encoding.TextMarshaler, shouldn't this be a non-error? […]

        Done

        We can simply use MapRange instead of MapIndex

    To view, visit change 278632. To unsubscribe, or for help writing mail filters, visit settings.

    Gerrit-Project: go
    Gerrit-Branch: master
    Gerrit-Change-Id: If4bc55229b1f64b8ca4b0fed37549725efdace39
    Gerrit-Change-Number: 278632
    Gerrit-PatchSet: 2
    Gerrit-Owner: Meng Zhuo <m...@golangcn.org>
    Gerrit-Reviewer: Cuong Manh Le <cuong.m...@gmail.com>
    Gerrit-Reviewer: Go Bot <go...@golang.org>
    Gerrit-Reviewer: Meng Zhuo <m...@golangcn.org>
    Gerrit-CC: Bryan C. Mills <bcm...@google.com>
    Gerrit-Attention: Bryan C. Mills <bcm...@google.com>
    Gerrit-Comment-Date: Thu, 17 Dec 2020 08:03:50 +0000
    Gerrit-HasComments: Yes
    Gerrit-Has-Labels: Yes
    Comment-In-Reply-To: Bryan C. Mills <bcm...@google.com>
    Gerrit-MessageType: comment

    Meng Zhuo (Gerrit)

    unread,
    Dec 30, 2020, 8:29:50 PM12/30/20
    to Meng Zhuo, goph...@pubsubhelper.golang.org, Joe Tsai, Go Bot, Bryan C. Mills, Cuong Manh Le, golang-co...@googlegroups.com

    Attention is currently required from: Bryan C. Mills, Joe Tsai.

    View Change

    1 comment:

    To view, visit change 278632. To unsubscribe, or for help writing mail filters, visit settings.

    Gerrit-Project: go
    Gerrit-Branch: master
    Gerrit-Change-Id: If4bc55229b1f64b8ca4b0fed37549725efdace39
    Gerrit-Change-Number: 278632
    Gerrit-PatchSet: 2
    Gerrit-Owner: Meng Zhuo <m...@golangcn.org>
    Gerrit-Reviewer: Cuong Manh Le <cuong.m...@gmail.com>
    Gerrit-Reviewer: Go Bot <go...@golang.org>
    Gerrit-Reviewer: Joe Tsai <joe...@google.com>
    Gerrit-Reviewer: Meng Zhuo <m...@golangcn.org>
    Gerrit-CC: Bryan C. Mills <bcm...@google.com>
    Gerrit-Attention: Bryan C. Mills <bcm...@google.com>
    Gerrit-Attention: Joe Tsai <joe...@google.com>
    Gerrit-Comment-Date: Thu, 31 Dec 2020 01:29:44 +0000

    Bryan C. Mills (Gerrit)

    unread,
    Jan 6, 2021, 10:13:47 AM1/6/21
    to Meng Zhuo, goph...@pubsubhelper.golang.org, Daniel Martí, Bryan C. Mills, Joe Tsai, Go Bot, Cuong Manh Le, golang-co...@googlegroups.com

    Attention is currently required from: Daniel Martí, Meng Zhuo, Joe Tsai.

    Patch set 2:Run-TryBot +1Code-Review +1Trust +1

    View Change

    1 comment:

    • File src/encoding/json/encode.go:

      • Patch Set #2, Line 780: || v.Kind() == reflect.Invalid {

        This part of the check should not be needed: `encode` should not be called on an invalid reflect.Value in the first place.

    To view, visit change 278632. To unsubscribe, or for help writing mail filters, visit settings.

    Gerrit-Project: go
    Gerrit-Branch: master
    Gerrit-Change-Id: If4bc55229b1f64b8ca4b0fed37549725efdace39
    Gerrit-Change-Number: 278632
    Gerrit-PatchSet: 2
    Gerrit-Owner: Meng Zhuo <m...@golangcn.org>
    Gerrit-Reviewer: Bryan C. Mills <bcm...@google.com>
    Gerrit-Reviewer: Cuong Manh Le <cuong.m...@gmail.com>
    Gerrit-Reviewer: Daniel Martí <mv...@mvdan.cc>
    Gerrit-Reviewer: Go Bot <go...@golang.org>
    Gerrit-Reviewer: Joe Tsai <joe...@google.com>
    Gerrit-Reviewer: Meng Zhuo <m...@golangcn.org>
    Gerrit-Attention: Daniel Martí <mv...@mvdan.cc>
    Gerrit-Attention: Meng Zhuo <m...@golangcn.org>
    Gerrit-Attention: Joe Tsai <joe...@google.com>
    Gerrit-Comment-Date: Wed, 06 Jan 2021 15:13:42 +0000
    Gerrit-HasComments: Yes
    Gerrit-Has-Labels: Yes
    Gerrit-MessageType: comment

    Daniel Martí (Gerrit)

    unread,
    Jan 6, 2021, 11:04:33 AM1/6/21
    to Meng Zhuo, goph...@pubsubhelper.golang.org, Bryan C. Mills, Joe Tsai, Go Bot, Cuong Manh Le, golang-co...@googlegroups.com

    Attention is currently required from: Meng Zhuo, Joe Tsai.

    View Change

    1 comment:

    • Patchset:

      • Patch Set #2:

        If this is a bug fix, I'm not sure why we're adding a benchmark. Also, I'm confused at all the results saying 0ns.

    To view, visit change 278632. To unsubscribe, or for help writing mail filters, visit settings.

    Gerrit-Project: go
    Gerrit-Branch: master
    Gerrit-Change-Id: If4bc55229b1f64b8ca4b0fed37549725efdace39
    Gerrit-Change-Number: 278632
    Gerrit-PatchSet: 2
    Gerrit-Owner: Meng Zhuo <m...@golangcn.org>
    Gerrit-Reviewer: Bryan C. Mills <bcm...@google.com>
    Gerrit-Reviewer: Cuong Manh Le <cuong.m...@gmail.com>
    Gerrit-Reviewer: Daniel Martí <mv...@mvdan.cc>
    Gerrit-Reviewer: Go Bot <go...@golang.org>
    Gerrit-Reviewer: Joe Tsai <joe...@google.com>
    Gerrit-Reviewer: Meng Zhuo <m...@golangcn.org>
    Gerrit-Attention: Meng Zhuo <m...@golangcn.org>
    Gerrit-Attention: Joe Tsai <joe...@google.com>
    Gerrit-Comment-Date: Wed, 06 Jan 2021 16:04:28 +0000

    Bryan C. Mills (Gerrit)

    unread,
    Jan 6, 2021, 11:33:48 AM1/6/21
    to Meng Zhuo, goph...@pubsubhelper.golang.org, Daniel Martí, Bryan C. Mills, Joe Tsai, Go Bot, Cuong Manh Le, golang-co...@googlegroups.com

    Attention is currently required from: Daniel Martí, Meng Zhuo, Joe Tsai.

    View Change

    1 comment:

    • Patchset:

      • Patch Set #2:

        If this is a bug fix, I'm not sure why we're adding a benchmark.

      • I suspect that the benchmark is intended to ensure that the change doesn't introduce a significant performance regression.

      • Also, I'm confused at all the results saying 0ns.

      • Ooh, good catch! Looks like the benchmark is forgetting to iterate over b.N.

        That would probably also be caught by CL 230978 (see #38677), but that check unfortunately did not make 1.16.

    To view, visit change 278632. To unsubscribe, or for help writing mail filters, visit settings.

    Gerrit-Project: go
    Gerrit-Branch: master
    Gerrit-Change-Id: If4bc55229b1f64b8ca4b0fed37549725efdace39
    Gerrit-Change-Number: 278632
    Gerrit-PatchSet: 2
    Gerrit-Owner: Meng Zhuo <m...@golangcn.org>
    Gerrit-Reviewer: Bryan C. Mills <bcm...@google.com>
    Gerrit-Reviewer: Cuong Manh Le <cuong.m...@gmail.com>
    Gerrit-Reviewer: Daniel Martí <mv...@mvdan.cc>
    Gerrit-Reviewer: Go Bot <go...@golang.org>
    Gerrit-Reviewer: Joe Tsai <joe...@google.com>
    Gerrit-Reviewer: Meng Zhuo <m...@golangcn.org>
    Gerrit-Attention: Daniel Martí <mv...@mvdan.cc>
    Gerrit-Attention: Meng Zhuo <m...@golangcn.org>
    Gerrit-Attention: Joe Tsai <joe...@google.com>
    Gerrit-Comment-Date: Wed, 06 Jan 2021 16:33:43 +0000
    Gerrit-HasComments: Yes
    Gerrit-Has-Labels: No
    Comment-In-Reply-To: Daniel Martí <mv...@mvdan.cc>
    Gerrit-MessageType: comment

    Daniel Martí (Gerrit)

    unread,
    Jan 6, 2021, 11:38:35 AM1/6/21
    to Meng Zhuo, goph...@pubsubhelper.golang.org, Bryan C. Mills, Joe Tsai, Go Bot, Cuong Manh Le, golang-co...@googlegroups.com

    Attention is currently required from: Bryan C. Mills, Meng Zhuo, Joe Tsai.

    View Change

    1 comment:

    • Patchset:

      • Patch Set #2:

        > If this is a bug fix, I'm not sure why we're adding a benchmark. […]

      • I get not wanting perf regressions, but I'm sure existing benchmarks already cover maps. I am worried that json is just gaining more micro-benchmarks which don't really help long-term.

    To view, visit change 278632. To unsubscribe, or for help writing mail filters, visit settings.

    Gerrit-Project: go
    Gerrit-Branch: master
    Gerrit-Change-Id: If4bc55229b1f64b8ca4b0fed37549725efdace39
    Gerrit-Change-Number: 278632
    Gerrit-PatchSet: 2
    Gerrit-Owner: Meng Zhuo <m...@golangcn.org>
    Gerrit-Reviewer: Bryan C. Mills <bcm...@google.com>
    Gerrit-Reviewer: Cuong Manh Le <cuong.m...@gmail.com>
    Gerrit-Reviewer: Daniel Martí <mv...@mvdan.cc>
    Gerrit-Reviewer: Go Bot <go...@golang.org>
    Gerrit-Reviewer: Joe Tsai <joe...@google.com>
    Gerrit-Reviewer: Meng Zhuo <m...@golangcn.org>
    Gerrit-Attention: Bryan C. Mills <bcm...@google.com>
    Gerrit-Attention: Meng Zhuo <m...@golangcn.org>
    Gerrit-Attention: Joe Tsai <joe...@google.com>
    Gerrit-Comment-Date: Wed, 06 Jan 2021 16:38:30 +0000
    Gerrit-HasComments: Yes
    Gerrit-Has-Labels: No
    Comment-In-Reply-To: Bryan C. Mills <bcm...@google.com>

    Meng Zhuo (Gerrit)

    unread,
    Jan 7, 2021, 1:14:21 AM1/7/21
    to Meng Zhuo, Bryan C. Mills, Daniel Martí, Go Bot, Cuong Manh Le, Joe Tsai, Joe Tsai, goph...@pubsubhelper.golang.org, golang-co...@googlegroups.com

    Attention is currently required from: Bryan C. Mills, Meng Zhuo, Joe Tsai.

    Meng Zhuo uploaded patch set #3 to this change.

    View Change

    encoding/json: MarshalMap by iteration

    The MarshalMap using MapIndex for accessing map value,
    Unfortunately it's invalid when underlying type is unsupported but type
    has implemented MarshalText interface. i.e.

    type A float64
    m :=map[A]int{math.NaN(): 1}

    As JSON spec(rfc7159) doesn't specified on duplicate objects, we can
    encode map with duplicate object.


    Fixes #43207

    Change-Id: If4bc55229b1f64b8ca4b0fed37549725efdace39
    ---
    M src/encoding/json/encode.go
    M src/encoding/json/encode_test.go
    2 files changed, 40 insertions(+), 17 deletions(-)

    To view, visit change 278632. To unsubscribe, or for help writing mail filters, visit settings.

    Gerrit-Project: go
    Gerrit-Branch: master
    Gerrit-Change-Id: If4bc55229b1f64b8ca4b0fed37549725efdace39
    Gerrit-Change-Number: 278632
    Gerrit-PatchSet: 3
    Gerrit-Owner: Meng Zhuo <m...@golangcn.org>
    Gerrit-Reviewer: Bryan C. Mills <bcm...@google.com>
    Gerrit-Reviewer: Cuong Manh Le <cuong.m...@gmail.com>
    Gerrit-Reviewer: Daniel Martí <mv...@mvdan.cc>
    Gerrit-Reviewer: Go Bot <go...@golang.org>
    Gerrit-Reviewer: Joe Tsai <joe...@google.com>
    Gerrit-Reviewer: Joe Tsai <thebroke...@gmail.com>
    Gerrit-Reviewer: Meng Zhuo <m...@golangcn.org>
    Gerrit-Attention: Bryan C. Mills <bcm...@google.com>
    Gerrit-Attention: Meng Zhuo <m...@golangcn.org>
    Gerrit-Attention: Joe Tsai <thebroke...@gmail.com>
    Gerrit-Attention: Joe Tsai <joe...@google.com>
    Gerrit-MessageType: newpatchset

    Meng Zhuo (Gerrit)

    unread,
    Jan 7, 2021, 1:15:23 AM1/7/21
    to Meng Zhuo, goph...@pubsubhelper.golang.org, Joe Tsai, Daniel Martí, Bryan C. Mills, Joe Tsai, Go Bot, Cuong Manh Le, golang-co...@googlegroups.com

    Attention is currently required from: Bryan C. Mills, Daniel Martí, Joe Tsai.

    Patch set 3:Run-TryBot +1

    View Change

    3 comments:

    • Patchset:

      • Patch Set #2:

        I get not wanting perf regressions, but I'm sure existing benchmarks already cover maps. […]

        Done

    • Patchset:

    • File src/encoding/json/encode.go:

      • This part of the check should not be needed: `encode` should not be called on an invalid reflect. […]

        Done

    To view, visit change 278632. To unsubscribe, or for help writing mail filters, visit settings.

    Gerrit-Project: go
    Gerrit-Branch: master
    Gerrit-Change-Id: If4bc55229b1f64b8ca4b0fed37549725efdace39
    Gerrit-Change-Number: 278632
    Gerrit-PatchSet: 3
    Gerrit-Owner: Meng Zhuo <m...@golangcn.org>
    Gerrit-Reviewer: Bryan C. Mills <bcm...@google.com>
    Gerrit-Reviewer: Cuong Manh Le <cuong.m...@gmail.com>
    Gerrit-Reviewer: Daniel Martí <mv...@mvdan.cc>
    Gerrit-Reviewer: Go Bot <go...@golang.org>
    Gerrit-Reviewer: Joe Tsai <joe...@google.com>
    Gerrit-Reviewer: Joe Tsai <thebroke...@gmail.com>
    Gerrit-Reviewer: Meng Zhuo <m...@golangcn.org>
    Gerrit-Attention: Bryan C. Mills <bcm...@google.com>
    Gerrit-Attention: Daniel Martí <mv...@mvdan.cc>
    Gerrit-Attention: Joe Tsai <thebroke...@gmail.com>
    Gerrit-Attention: Joe Tsai <joe...@google.com>
    Gerrit-Comment-Date: Thu, 07 Jan 2021 06:15:17 +0000
    Gerrit-HasComments: Yes
    Gerrit-Has-Labels: Yes

    Bryan C. Mills (Gerrit)

    unread,
    Jan 7, 2021, 9:55:05 AM1/7/21
    to Meng Zhuo, goph...@pubsubhelper.golang.org, Bryan C. Mills, Go Bot, Joe Tsai, Daniel Martí, Joe Tsai, Cuong Manh Le, golang-co...@googlegroups.com

    Attention is currently required from: Daniel Martí, Meng Zhuo, Joe Tsai.

    Patch set 3:Code-Review +1

    View Change

      To view, visit change 278632. To unsubscribe, or for help writing mail filters, visit settings.

      Gerrit-Project: go
      Gerrit-Branch: master
      Gerrit-Change-Id: If4bc55229b1f64b8ca4b0fed37549725efdace39
      Gerrit-Change-Number: 278632
      Gerrit-PatchSet: 3
      Gerrit-Owner: Meng Zhuo <m...@golangcn.org>
      Gerrit-Reviewer: Bryan C. Mills <bcm...@google.com>
      Gerrit-Reviewer: Cuong Manh Le <cuong.m...@gmail.com>
      Gerrit-Reviewer: Daniel Martí <mv...@mvdan.cc>
      Gerrit-Reviewer: Go Bot <go...@golang.org>
      Gerrit-Reviewer: Joe Tsai <joe...@google.com>
      Gerrit-Reviewer: Joe Tsai <thebroke...@gmail.com>
      Gerrit-Reviewer: Meng Zhuo <m...@golangcn.org>
      Gerrit-Attention: Daniel Martí <mv...@mvdan.cc>
      Gerrit-Attention: Meng Zhuo <m...@golangcn.org>
      Gerrit-Attention: Joe Tsai <thebroke...@gmail.com>
      Gerrit-Attention: Joe Tsai <joe...@google.com>
      Gerrit-Comment-Date: Thu, 07 Jan 2021 14:55:00 +0000

      Joe Tsai (Gerrit)

      unread,
      Jan 19, 2021, 8:55:19 PM1/19/21
      to Meng Zhuo, goph...@pubsubhelper.golang.org, Joe Tsai, Bryan C. Mills, Go Bot, Daniel Martí, Joe Tsai, Cuong Manh Le, golang-co...@googlegroups.com

      Attention is currently required from: Daniel Martí, Meng Zhuo, Joe Tsai.

      Patch set 3:Code-Review +1

      View Change

      9 comments:


        • The MarshalMap using MapIndex for accessing map value,
          Unfortunately it's invalid when underlying type is unsupported but type
          has implemented MarshalText interface. i.e.

        • Again, there is no MarshalMap function.

          Perhaps:
          > Map serialization using reflect.Value.MapIndex cannot retrieve map keys that contain a NaN, resulting in a panic. Switch the implementation to use the reflect.Value.MapRange method instead, which iterates over all map entries regardless of whether they are directly retrievable.

        • Patch Set #3, Line 14: :=

          Nit: space after :=

        • Patch Set #3, Line 15:


        • As JSON spec(rfc7159) doesn't specified on duplicate objects, we can
          encode map with duplicate object.

        • It *does* actually specify duplicate names, it just specifies that it is implementation specific behavior.

          Thus, this should say something like:
          > Note that according to RFC 8259, section 4, a JSON object should have unique names, but does not forbid the occurrence of duplicate names.

          Also, RFC 7159 has been obsoleted by RFC 8259, so we should use the latter.

      • Patchset:

      • File src/encoding/json/encode_test.go:

      To view, visit change 278632. To unsubscribe, or for help writing mail filters, visit settings.

      Gerrit-Project: go
      Gerrit-Branch: master
      Gerrit-Change-Id: If4bc55229b1f64b8ca4b0fed37549725efdace39
      Gerrit-Change-Number: 278632
      Gerrit-PatchSet: 3
      Gerrit-Owner: Meng Zhuo <m...@golangcn.org>
      Gerrit-Reviewer: Bryan C. Mills <bcm...@google.com>
      Gerrit-Reviewer: Cuong Manh Le <cuong.m...@gmail.com>
      Gerrit-Reviewer: Daniel Martí <mv...@mvdan.cc>
      Gerrit-Reviewer: Go Bot <go...@golang.org>
      Gerrit-Reviewer: Joe Tsai <joe...@google.com>
      Gerrit-Reviewer: Joe Tsai <thebroke...@gmail.com>
      Gerrit-Reviewer: Meng Zhuo <m...@golangcn.org>
      Gerrit-Attention: Daniel Martí <mv...@mvdan.cc>
      Gerrit-Attention: Meng Zhuo <m...@golangcn.org>
      Gerrit-Attention: Joe Tsai <joe...@google.com>
      Gerrit-Comment-Date: Wed, 20 Jan 2021 01:55:13 +0000
      Gerrit-HasComments: Yes
      Gerrit-Has-Labels: Yes
      Gerrit-MessageType: comment

      Meng Zhuo (Gerrit)

      unread,
      Jan 20, 2021, 8:50:22 AM1/20/21
      to Meng Zhuo, goph...@pubsubhelper.golang.org, golang-co...@googlegroups.com

      Attention is currently required from: Daniel Martí, Meng Zhuo, Joe Tsai.

      Meng Zhuo uploaded patch set #4 to this change.

      View Change

      encoding/json: marshal maps using reflect.Value.MapRange

      Map serialization using reflect.Value.MapIndex cannot retrieve
      map keys that contain a NaN, resulting in a panic.
      Switch the implementation to use the reflect.Value.MapRange method
      instead, which iterates over all map entries regardless of whether
      they are directly retrievable. i.e.


      type A float64
      m := map[A]int{math.NaN(): 1}

      Note that according to RFC 8259, section 4, a JSON object should
      have unique names, but does not forbid the occurrence of duplicate names.

      Fixes #43207

      Change-Id: If4bc55229b1f64b8ca4b0fed37549725efdace39
      ---
      M src/encoding/json/encode.go
      M src/encoding/json/encode_test.go
      2 files changed, 40 insertions(+), 17 deletions(-)

      To view, visit change 278632. To unsubscribe, or for help writing mail filters, visit settings.

      Gerrit-Project: go
      Gerrit-Branch: master
      Gerrit-Change-Id: If4bc55229b1f64b8ca4b0fed37549725efdace39
      Gerrit-Change-Number: 278632
      Gerrit-PatchSet: 4
      Gerrit-Owner: Meng Zhuo <m...@golangcn.org>
      Gerrit-Reviewer: Bryan C. Mills <bcm...@google.com>
      Gerrit-Reviewer: Cuong Manh Le <cuong.m...@gmail.com>
      Gerrit-Reviewer: Daniel Martí <mv...@mvdan.cc>
      Gerrit-Reviewer: Go Bot <go...@golang.org>
      Gerrit-Reviewer: Joe Tsai <joe...@google.com>
      Gerrit-Reviewer: Joe Tsai <thebroke...@gmail.com>
      Gerrit-Reviewer: Meng Zhuo <m...@golangcn.org>
      Gerrit-Attention: Daniel Martí <mv...@mvdan.cc>
      Gerrit-Attention: Meng Zhuo <m...@golangcn.org>
      Gerrit-Attention: Joe Tsai <joe...@google.com>
      Gerrit-MessageType: newpatchset

      Meng Zhuo (Gerrit)

      unread,
      Jan 20, 2021, 8:52:00 AM1/20/21
      to Meng Zhuo, goph...@pubsubhelper.golang.org, Joe Tsai, Bryan C. Mills, Go Bot, Daniel Martí, Joe Tsai, Cuong Manh Le, golang-co...@googlegroups.com

      Attention is currently required from: Daniel Martí, Joe Tsai.

      View Change

      9 comments:

      • Commit Message:

        • There is no exported function named MarshalMap […]

          Done

        • Patch Set #3, Line 8:


          The MarshalMap using MapIndex for accessing map value,
          Unfortunately it's invalid when underlying type is unsupported but type
          has implemented MarshalText interface. i.e.

        • Again, there is no MarshalMap function. […]

          Done

        • Done

        • Patch Set #3, Line 15:


          As JSON spec(rfc7159) doesn't specified on duplicate objects, we can
          encode map with duplicate object.

        • It *does* actually specify duplicate names, it just specifies that it is implementation specific beh […]

          Done

      • Patchset:

      • File src/encoding/json/encode_test.go:

        • Done

        • Style nit: […]

          Done

        • Done

        • Style nit: […]

          Done

      To view, visit change 278632. To unsubscribe, or for help writing mail filters, visit settings.

      Gerrit-Project: go
      Gerrit-Branch: master
      Gerrit-Change-Id: If4bc55229b1f64b8ca4b0fed37549725efdace39
      Gerrit-Change-Number: 278632
      Gerrit-PatchSet: 4
      Gerrit-Owner: Meng Zhuo <m...@golangcn.org>
      Gerrit-Reviewer: Bryan C. Mills <bcm...@google.com>
      Gerrit-Reviewer: Cuong Manh Le <cuong.m...@gmail.com>
      Gerrit-Reviewer: Daniel Martí <mv...@mvdan.cc>
      Gerrit-Reviewer: Go Bot <go...@golang.org>
      Gerrit-Reviewer: Joe Tsai <joe...@google.com>
      Gerrit-Reviewer: Joe Tsai <thebroke...@gmail.com>
      Gerrit-Reviewer: Meng Zhuo <m...@golangcn.org>
      Gerrit-Attention: Daniel Martí <mv...@mvdan.cc>
      Gerrit-Attention: Joe Tsai <thebroke...@gmail.com>
      Gerrit-Attention: Joe Tsai <joe...@google.com>
      Gerrit-Comment-Date: Wed, 20 Jan 2021 13:51:54 +0000
      Gerrit-HasComments: Yes
      Gerrit-Has-Labels: No
      Comment-In-Reply-To: Joe Tsai <thebroke...@gmail.com>
      Gerrit-MessageType: comment

      Bryan C. Mills (Gerrit)

      unread,
      Jan 20, 2021, 9:49:11 AM1/20/21
      to Meng Zhuo, goph...@pubsubhelper.golang.org, Go Bot, Joe Tsai, Bryan C. Mills, Daniel Martí, Joe Tsai, Cuong Manh Le, golang-co...@googlegroups.com

      Attention is currently required from: Daniel Martí, Meng Zhuo, Joe Tsai.

      Bryan C. Mills removed a vote from this change.

      View Change

      Removed TryBot-Result-1 by Go Bot <go...@golang.org>

      To view, visit change 278632. To unsubscribe, or for help writing mail filters, visit settings.

      Gerrit-Project: go
      Gerrit-Branch: master
      Gerrit-Change-Id: If4bc55229b1f64b8ca4b0fed37549725efdace39
      Gerrit-Change-Number: 278632
      Gerrit-PatchSet: 4
      Gerrit-Owner: Meng Zhuo <m...@golangcn.org>
      Gerrit-Reviewer: Bryan C. Mills <bcm...@google.com>
      Gerrit-Reviewer: Cuong Manh Le <cuong.m...@gmail.com>
      Gerrit-Reviewer: Daniel Martí <mv...@mvdan.cc>
      Gerrit-Reviewer: Go Bot <go...@golang.org>
      Gerrit-Reviewer: Joe Tsai <joe...@google.com>
      Gerrit-Reviewer: Joe Tsai <thebroke...@gmail.com>
      Gerrit-Reviewer: Meng Zhuo <m...@golangcn.org>
      Gerrit-Attention: Daniel Martí <mv...@mvdan.cc>
      Gerrit-Attention: Meng Zhuo <m...@golangcn.org>
      Gerrit-Attention: Joe Tsai <thebroke...@gmail.com>
      Gerrit-Attention: Joe Tsai <joe...@google.com>
      Gerrit-MessageType: deleteVote

      Joe Tsai (Gerrit)

      unread,
      Jan 20, 2021, 12:43:29 PM1/20/21
      to Meng Zhuo, goph...@pubsubhelper.golang.org, Joe Tsai, Go Bot, Bryan C. Mills, Daniel Martí, Joe Tsai, Cuong Manh Le, golang-co...@googlegroups.com

      Attention is currently required from: Daniel Martí, Meng Zhuo, Joe Tsai.

      Patch set 4:Code-Review +2Trust +1

      View Change

      1 comment:

        • i.e.

          type A float64
          m := map[A]int{math.NaN(): 1}

        • This should be "e.g." not "i.e."
          You can literally treat "i.e." as "that is"
          and treat "e.g." as "for example".
          It's one of those weird cases where Latin has entered the English language.

          However, this example itself is already incorrect since it you can't natively serialize a float without the MarshalText method, which this doesn't show.

          Perhaps:
          type F float64
          func (f F) MarshalText() ([]byte, error) {
          return []byte(fmt.Sprint(f)), nil
          }
          json.Marshal(map[F]int{math.NaN(): 1}) // should not panic

      To view, visit change 278632. To unsubscribe, or for help writing mail filters, visit settings.

      Gerrit-Project: go
      Gerrit-Branch: master
      Gerrit-Change-Id: If4bc55229b1f64b8ca4b0fed37549725efdace39
      Gerrit-Change-Number: 278632
      Gerrit-PatchSet: 4
      Gerrit-Owner: Meng Zhuo <m...@golangcn.org>
      Gerrit-Reviewer: Bryan C. Mills <bcm...@google.com>
      Gerrit-Reviewer: Cuong Manh Le <cuong.m...@gmail.com>
      Gerrit-Reviewer: Daniel Martí <mv...@mvdan.cc>
      Gerrit-Reviewer: Go Bot <go...@golang.org>
      Gerrit-Reviewer: Joe Tsai <joe...@google.com>
      Gerrit-Reviewer: Joe Tsai <thebroke...@gmail.com>
      Gerrit-Reviewer: Meng Zhuo <m...@golangcn.org>
      Gerrit-Attention: Daniel Martí <mv...@mvdan.cc>
      Gerrit-Attention: Meng Zhuo <m...@golangcn.org>
      Gerrit-Attention: Joe Tsai <joe...@google.com>
      Gerrit-Comment-Date: Wed, 20 Jan 2021 17:43:16 +0000

      Meng Zhuo (Gerrit)

      unread,
      Jan 21, 2021, 9:55:48 AM1/21/21
      to Meng Zhuo, goph...@pubsubhelper.golang.org, golang-co...@googlegroups.com

      Attention is currently required from: Daniel Martí, Meng Zhuo, Joe Tsai.

      Meng Zhuo uploaded patch set #5 to this change.

      View Change

      encoding/json: marshal maps using reflect.Value.MapRange

      Map serialization using reflect.Value.MapIndex cannot retrieve
      map keys that contain a NaN, resulting in a panic.
      Switch the implementation to use the reflect.Value.MapRange method
      instead, which iterates over all map entries regardless of whether
      they are directly retrievable.

      Note that according to RFC 8259, section 4, a JSON object should
      have unique names, but does not forbid the occurrence of duplicate names.

      Fixes #43207

      Change-Id: If4bc55229b1f64b8ca4b0fed37549725efdace39
      ---
      M src/encoding/json/encode.go
      M src/encoding/json/encode_test.go
      2 files changed, 40 insertions(+), 17 deletions(-)

      To view, visit change 278632. To unsubscribe, or for help writing mail filters, visit settings.

      Gerrit-Project: go
      Gerrit-Branch: master
      Gerrit-Change-Id: If4bc55229b1f64b8ca4b0fed37549725efdace39
      Gerrit-Change-Number: 278632
      Gerrit-PatchSet: 5
      Gerrit-Owner: Meng Zhuo <m...@golangcn.org>
      Gerrit-Reviewer: Bryan C. Mills <bcm...@google.com>
      Gerrit-Reviewer: Cuong Manh Le <cuong.m...@gmail.com>
      Gerrit-Reviewer: Daniel Martí <mv...@mvdan.cc>
      Gerrit-Reviewer: Go Bot <go...@golang.org>
      Gerrit-Reviewer: Joe Tsai <joe...@google.com>
      Gerrit-Reviewer: Joe Tsai <thebroke...@gmail.com>
      Gerrit-Reviewer: Meng Zhuo <m...@golangcn.org>
      Gerrit-Attention: Daniel Martí <mv...@mvdan.cc>
      Gerrit-Attention: Meng Zhuo <m...@golangcn.org>
      Gerrit-Attention: Joe Tsai <joe...@google.com>
      Gerrit-MessageType: newpatchset

      Meng Zhuo (Gerrit)

      unread,
      Jan 21, 2021, 9:55:58 AM1/21/21
      to Meng Zhuo, goph...@pubsubhelper.golang.org, Joe Tsai, Go Bot, Bryan C. Mills, Daniel Martí, Joe Tsai, Cuong Manh Le, golang-co...@googlegroups.com

      Attention is currently required from: Daniel Martí, Joe Tsai.

      View Change

      2 comments:

      • Commit Message:

        • This should be "e.g." not "i.e." […]

          Done

      • Patchset:

        • Patch Set #4:

          Thanks for clear this up.
          I think we should remove this example this not very helpful.

      To view, visit change 278632. To unsubscribe, or for help writing mail filters, visit settings.

      Gerrit-Project: go
      Gerrit-Branch: master
      Gerrit-Change-Id: If4bc55229b1f64b8ca4b0fed37549725efdace39
      Gerrit-Change-Number: 278632
      Gerrit-PatchSet: 4
      Gerrit-Owner: Meng Zhuo <m...@golangcn.org>
      Gerrit-Reviewer: Bryan C. Mills <bcm...@google.com>
      Gerrit-Reviewer: Cuong Manh Le <cuong.m...@gmail.com>
      Gerrit-Reviewer: Daniel Martí <mv...@mvdan.cc>
      Gerrit-Reviewer: Go Bot <go...@golang.org>
      Gerrit-Reviewer: Joe Tsai <joe...@google.com>
      Gerrit-Reviewer: Joe Tsai <thebroke...@gmail.com>
      Gerrit-Reviewer: Meng Zhuo <m...@golangcn.org>
      Gerrit-Attention: Daniel Martí <mv...@mvdan.cc>
      Gerrit-Attention: Joe Tsai <joe...@google.com>
      Gerrit-Comment-Date: Thu, 21 Jan 2021 14:55:52 +0000

      Meng Zhuo (Gerrit)

      unread,
      Jan 21, 2021, 9:59:22 AM1/21/21
      to Meng Zhuo, goph...@pubsubhelper.golang.org, Joe Tsai, Go Bot, Bryan C. Mills, Daniel Martí, Joe Tsai, Cuong Manh Le, golang-co...@googlegroups.com

      Attention is currently required from: Daniel Martí, Joe Tsai.

      View Change

      1 comment:

      • Patchset:

        • Patch Set #5:

          Hi, Joe

          This CL is a bug, is it OK to merge this CL into Go 1.16?

      To view, visit change 278632. To unsubscribe, or for help writing mail filters, visit settings.

      Gerrit-Project: go
      Gerrit-Branch: master
      Gerrit-Change-Id: If4bc55229b1f64b8ca4b0fed37549725efdace39
      Gerrit-Change-Number: 278632
      Gerrit-PatchSet: 5
      Gerrit-Owner: Meng Zhuo <m...@golangcn.org>
      Gerrit-Reviewer: Bryan C. Mills <bcm...@google.com>
      Gerrit-Reviewer: Cuong Manh Le <cuong.m...@gmail.com>
      Gerrit-Reviewer: Daniel Martí <mv...@mvdan.cc>
      Gerrit-Reviewer: Go Bot <go...@golang.org>
      Gerrit-Reviewer: Joe Tsai <joe...@google.com>
      Gerrit-Reviewer: Joe Tsai <thebroke...@gmail.com>
      Gerrit-Reviewer: Meng Zhuo <m...@golangcn.org>
      Gerrit-Attention: Daniel Martí <mv...@mvdan.cc>
      Gerrit-Attention: Joe Tsai <joe...@google.com>
      Gerrit-Comment-Date: Thu, 21 Jan 2021 14:59:14 +0000
      Gerrit-HasComments: Yes
      Gerrit-Has-Labels: No
      Gerrit-MessageType: comment

      Bryan C. Mills (Gerrit)

      unread,
      Jan 21, 2021, 10:35:05 AM1/21/21
      to Meng Zhuo, goph...@pubsubhelper.golang.org, Go Bot, Joe Tsai, Bryan C. Mills, Daniel Martí, Joe Tsai, Cuong Manh Le, golang-co...@googlegroups.com

      Attention is currently required from: Daniel Martí, Meng Zhuo, Joe Tsai.

      Bryan C. Mills removed a vote from this change.

      View Change

      Removed TryBot-Result-1 by Go Bot <go...@golang.org>

      To view, visit change 278632. To unsubscribe, or for help writing mail filters, visit settings.

      Gerrit-Project: go
      Gerrit-Branch: master
      Gerrit-Change-Id: If4bc55229b1f64b8ca4b0fed37549725efdace39
      Gerrit-Change-Number: 278632
      Gerrit-PatchSet: 5
      Gerrit-Owner: Meng Zhuo <m...@golangcn.org>
      Gerrit-Reviewer: Bryan C. Mills <bcm...@google.com>
      Gerrit-Reviewer: Cuong Manh Le <cuong.m...@gmail.com>
      Gerrit-Reviewer: Daniel Martí <mv...@mvdan.cc>
      Gerrit-Reviewer: Go Bot <go...@golang.org>
      Gerrit-Reviewer: Joe Tsai <joe...@google.com>
      Gerrit-Reviewer: Joe Tsai <thebroke...@gmail.com>
      Gerrit-Reviewer: Meng Zhuo <m...@golangcn.org>
      Gerrit-Attention: Daniel Martí <mv...@mvdan.cc>
      Gerrit-Attention: Meng Zhuo <m...@golangcn.org>
      Gerrit-Attention: Joe Tsai <joe...@google.com>
      Gerrit-MessageType: deleteVote

      Bryan C. Mills (Gerrit)

      unread,
      Jan 21, 2021, 10:54:47 AM1/21/21
      to Meng Zhuo, goph...@pubsubhelper.golang.org, Go Bot, Joe Tsai, Bryan C. Mills, Daniel Martí, Joe Tsai, Cuong Manh Le, golang-co...@googlegroups.com

      Attention is currently required from: Daniel Martí, Meng Zhuo, Joe Tsai.

      View Change

      1 comment:

      To view, visit change 278632. To unsubscribe, or for help writing mail filters, visit settings.

      Gerrit-Project: go
      Gerrit-Branch: master
      Gerrit-Change-Id: If4bc55229b1f64b8ca4b0fed37549725efdace39
      Gerrit-Change-Number: 278632
      Gerrit-PatchSet: 5
      Gerrit-Owner: Meng Zhuo <m...@golangcn.org>
      Gerrit-Reviewer: Bryan C. Mills <bcm...@google.com>
      Gerrit-Reviewer: Cuong Manh Le <cuong.m...@gmail.com>
      Gerrit-Reviewer: Daniel Martí <mv...@mvdan.cc>
      Gerrit-Reviewer: Go Bot <go...@golang.org>
      Gerrit-Reviewer: Joe Tsai <joe...@google.com>
      Gerrit-Reviewer: Joe Tsai <thebroke...@gmail.com>
      Gerrit-Reviewer: Meng Zhuo <m...@golangcn.org>
      Gerrit-Attention: Daniel Martí <mv...@mvdan.cc>
      Gerrit-Attention: Meng Zhuo <m...@golangcn.org>
      Gerrit-Attention: Joe Tsai <joe...@google.com>
      Gerrit-Comment-Date: Thu, 21 Jan 2021 15:54:41 +0000

      Bryan C. Mills (Gerrit)

      unread,
      Jan 21, 2021, 10:54:48 AM1/21/21
      to Meng Zhuo, goph...@pubsubhelper.golang.org, Go Bot, Joe Tsai, Bryan C. Mills, Daniel Martí, Joe Tsai, Cuong Manh Le, golang-co...@googlegroups.com

      Attention is currently required from: Daniel Martí, Meng Zhuo, Joe Tsai.

      Bryan C. Mills removed a vote from this change.

      View Change

      Removed TryBot-Result-1 by Go Bot <go...@golang.org>

      To view, visit change 278632. To unsubscribe, or for help writing mail filters, visit settings.

      Gerrit-Project: go
      Gerrit-Branch: master
      Gerrit-Change-Id: If4bc55229b1f64b8ca4b0fed37549725efdace39
      Gerrit-Change-Number: 278632
      Gerrit-PatchSet: 5
      Gerrit-Owner: Meng Zhuo <m...@golangcn.org>
      Gerrit-Reviewer: Bryan C. Mills <bcm...@google.com>
      Gerrit-Reviewer: Cuong Manh Le <cuong.m...@gmail.com>
      Gerrit-Reviewer: Daniel Martí <mv...@mvdan.cc>
      Gerrit-Reviewer: Go Bot <go...@golang.org>
      Gerrit-Reviewer: Joe Tsai <joe...@google.com>
      Gerrit-Reviewer: Joe Tsai <thebroke...@gmail.com>
      Gerrit-Reviewer: Meng Zhuo <m...@golangcn.org>
      Gerrit-Attention: Daniel Martí <mv...@mvdan.cc>
      Gerrit-Attention: Meng Zhuo <m...@golangcn.org>
      Gerrit-Attention: Joe Tsai <joe...@google.com>
      Gerrit-MessageType: deleteVote

      Joe Tsai (Gerrit)

      unread,
      Jan 21, 2021, 1:17:36 PM1/21/21
      to Meng Zhuo, goph...@pubsubhelper.golang.org, Go Bot, Joe Tsai, Bryan C. Mills, Daniel Martí, Joe Tsai, Cuong Manh Le, golang-co...@googlegroups.com

      Attention is currently required from: Daniel Martí, Meng Zhuo, Joe Tsai.

      View Change

      1 comment:

      • Patchset:

        • Patch Set #5:

          Hi, Joe […]

          I believe Go1.16 is frozen. This will have to wait for Go1.17 to be merged.

      To view, visit change 278632. To unsubscribe, or for help writing mail filters, visit settings.

      Gerrit-Project: go
      Gerrit-Branch: master
      Gerrit-Change-Id: If4bc55229b1f64b8ca4b0fed37549725efdace39
      Gerrit-Change-Number: 278632
      Gerrit-PatchSet: 5
      Gerrit-Owner: Meng Zhuo <m...@golangcn.org>
      Gerrit-Reviewer: Bryan C. Mills <bcm...@google.com>
      Gerrit-Reviewer: Cuong Manh Le <cuong.m...@gmail.com>
      Gerrit-Reviewer: Daniel Martí <mv...@mvdan.cc>
      Gerrit-Reviewer: Go Bot <go...@golang.org>
      Gerrit-Reviewer: Joe Tsai <joe...@google.com>
      Gerrit-Reviewer: Joe Tsai <thebroke...@gmail.com>
      Gerrit-Reviewer: Meng Zhuo <m...@golangcn.org>
      Gerrit-Attention: Daniel Martí <mv...@mvdan.cc>
      Gerrit-Attention: Meng Zhuo <m...@golangcn.org>
      Gerrit-Attention: Joe Tsai <joe...@google.com>
      Gerrit-Comment-Date: Thu, 21 Jan 2021 18:17:31 +0000
      Gerrit-HasComments: Yes
      Gerrit-Has-Labels: No
      Comment-In-Reply-To: Meng Zhuo <m...@golangcn.org>
      Gerrit-MessageType: comment

      Bryan C. Mills (Gerrit)

      unread,
      Jan 21, 2021, 1:26:38 PM1/21/21
      to Meng Zhuo, goph...@pubsubhelper.golang.org, Go Bot, Joe Tsai, Bryan C. Mills, Daniel Martí, Joe Tsai, Cuong Manh Le, golang-co...@googlegroups.com

      Attention is currently required from: Daniel Martí, Meng Zhuo, Joe Tsai.

      View Change

      1 comment:

      • Patchset:

        • Patch Set #5:

          I believe Go1.16 is frozen. This will have to wait for Go1.17 to be merged.

          Go 1.16 is frozen, but the tree is still open for bug-fixes (which this is, because it causes a panic when the `encoding/json` API is used as documented).

          That said, we're very close to the release, so it's not obvious to me whether this change is too invasive for this point in the cycle.

      To view, visit change 278632. To unsubscribe, or for help writing mail filters, visit settings.

      Gerrit-Project: go
      Gerrit-Branch: master
      Gerrit-Change-Id: If4bc55229b1f64b8ca4b0fed37549725efdace39
      Gerrit-Change-Number: 278632
      Gerrit-PatchSet: 5
      Gerrit-Owner: Meng Zhuo <m...@golangcn.org>
      Gerrit-Reviewer: Bryan C. Mills <bcm...@google.com>
      Gerrit-Reviewer: Cuong Manh Le <cuong.m...@gmail.com>
      Gerrit-Reviewer: Daniel Martí <mv...@mvdan.cc>
      Gerrit-Reviewer: Go Bot <go...@golang.org>
      Gerrit-Reviewer: Joe Tsai <joe...@google.com>
      Gerrit-Reviewer: Joe Tsai <thebroke...@gmail.com>
      Gerrit-Reviewer: Meng Zhuo <m...@golangcn.org>
      Gerrit-Attention: Daniel Martí <mv...@mvdan.cc>
      Gerrit-Attention: Meng Zhuo <m...@golangcn.org>
      Gerrit-Attention: Joe Tsai <joe...@google.com>
      Gerrit-Comment-Date: Thu, 21 Jan 2021 18:26:34 +0000
      Gerrit-HasComments: Yes
      Gerrit-Has-Labels: No
      Comment-In-Reply-To: Meng Zhuo <m...@golangcn.org>

      Joe Tsai (Gerrit)

      unread,
      Jan 21, 2021, 3:34:55 PM1/21/21
      to Meng Zhuo, goph...@pubsubhelper.golang.org, Go Bot, Joe Tsai, Bryan C. Mills, Daniel Martí, Joe Tsai, Cuong Manh Le, golang-co...@googlegroups.com

      Attention is currently required from: Bryan C. Mills, Daniel Martí, Meng Zhuo, Joe Tsai.

      View Change

      1 comment:

      • Patchset:

        • Patch Set #5:

          Go 1. […]

          This switches map iteration to a different mechanism and may have vastly different performance characteristics. At the very least, we need to benchmark this to understand the impact. I suspect that this will be faster, but we need to prove that.

      To view, visit change 278632. To unsubscribe, or for help writing mail filters, visit settings.

      Gerrit-Project: go
      Gerrit-Branch: master
      Gerrit-Change-Id: If4bc55229b1f64b8ca4b0fed37549725efdace39
      Gerrit-Change-Number: 278632
      Gerrit-PatchSet: 5
      Gerrit-Owner: Meng Zhuo <m...@golangcn.org>
      Gerrit-Reviewer: Bryan C. Mills <bcm...@google.com>
      Gerrit-Reviewer: Cuong Manh Le <cuong.m...@gmail.com>
      Gerrit-Reviewer: Daniel Martí <mv...@mvdan.cc>
      Gerrit-Reviewer: Go Bot <go...@golang.org>
      Gerrit-Reviewer: Joe Tsai <joe...@google.com>
      Gerrit-Reviewer: Joe Tsai <thebroke...@gmail.com>
      Gerrit-Reviewer: Meng Zhuo <m...@golangcn.org>
      Gerrit-Attention: Bryan C. Mills <bcm...@google.com>
      Gerrit-Attention: Daniel Martí <mv...@mvdan.cc>
      Gerrit-Attention: Meng Zhuo <m...@golangcn.org>
      Gerrit-Attention: Joe Tsai <joe...@google.com>
      Gerrit-Comment-Date: Thu, 21 Jan 2021 20:34:50 +0000
      Gerrit-HasComments: Yes
      Gerrit-Has-Labels: No
      Comment-In-Reply-To: Bryan C. Mills <bcm...@google.com>

      Meng Zhuo (Gerrit)

      unread,
      Feb 3, 2021, 3:12:45 AM2/3/21
      to Meng Zhuo, goph...@pubsubhelper.golang.org, Go Bot, Joe Tsai, Bryan C. Mills, Daniel Martí, Joe Tsai, Cuong Manh Le, golang-co...@googlegroups.com

      Attention is currently required from: Bryan C. Mills, Daniel Martí, Joe Tsai.

      View Change

      1 comment:

      • Patchset:

        • Patch Set #5:

          This switches map iteration to a different mechanism and may have vastly different performance chara […]

          Hi, Joe

          I've uploaded patchset #2 that contains a benchmark, could you take a look?

        • name old time/op new time/op delta
          MarshalMap/Item=32 0.00ns ±24% 0.00ns ±21% -11.18% (p=0.018 n=9+9)
          MarshalMap/Item=64 0.00ns ± 8% 0.00ns ± 8% -8.00% (p=0.002 n=10+10)
          MarshalMap/Item=128 0.00ns ± 4% 0.00ns ±20% -8.31% (p=0.010 n=9+9)
          MarshalMap/Item=256 0.00ns ± 3% 0.00ns ± 3% -9.28% (p=0.000 n=10+10)
          MarshalMap/Item=512 0.00ns ± 1% 0.00ns ±10% -6.59% (p=0.005 n=8+10)
          MarshalMap/Item=1024 0.00ns ± 2% 0.00ns ± 4% -8.53% (p=0.000 n=9+9)
          MarshalMap/Item=2048 0.00ns ± 2% 0.00ns ± 2% -8.29% (p=0.000 n=9+8)
          MarshalMap/Item=4096 0.00ns ± 7% 0.00ns ± 2% -8.82% (p=0.000 n=9+10)

      To view, visit change 278632. To unsubscribe, or for help writing mail filters, visit settings.

      Gerrit-Project: go
      Gerrit-Branch: master
      Gerrit-Change-Id: If4bc55229b1f64b8ca4b0fed37549725efdace39
      Gerrit-Change-Number: 278632
      Gerrit-PatchSet: 5
      Gerrit-Owner: Meng Zhuo <m...@golangcn.org>
      Gerrit-Reviewer: Bryan C. Mills <bcm...@google.com>
      Gerrit-Reviewer: Cuong Manh Le <cuong.m...@gmail.com>
      Gerrit-Reviewer: Daniel Martí <mv...@mvdan.cc>
      Gerrit-Reviewer: Go Bot <go...@golang.org>
      Gerrit-Reviewer: Joe Tsai <joe...@google.com>
      Gerrit-Reviewer: Joe Tsai <thebroke...@gmail.com>
      Gerrit-Reviewer: Meng Zhuo <m...@golangcn.org>
      Gerrit-Attention: Bryan C. Mills <bcm...@google.com>
      Gerrit-Attention: Daniel Martí <mv...@mvdan.cc>
      Gerrit-Attention: Joe Tsai <thebroke...@gmail.com>
      Gerrit-Attention: Joe Tsai <joe...@google.com>
      Gerrit-Comment-Date: Wed, 03 Feb 2021 08:12:39 +0000

      Bryan C. Mills (Gerrit)

      unread,
      Feb 5, 2021, 2:35:20 PM2/5/21
      to Meng Zhuo, goph...@pubsubhelper.golang.org, Go Bot, Joe Tsai, Bryan C. Mills, Daniel Martí, Joe Tsai, Cuong Manh Le, golang-co...@googlegroups.com

      Attention is currently required from: Daniel Martí, Meng Zhuo, Joe Tsai.

      View Change

      1 comment:

      • Patchset:

        • Patch Set #5:

          Hi, Joe […]

          0.00ns/op indicates that the benchmark was not actually using b.N, so those results are probably not valid.

          (Even ~10 instructions would be 1.0 ns/op or more.)

      To view, visit change 278632. To unsubscribe, or for help writing mail filters, visit settings.

      Gerrit-Project: go
      Gerrit-Branch: master
      Gerrit-Change-Id: If4bc55229b1f64b8ca4b0fed37549725efdace39
      Gerrit-Change-Number: 278632
      Gerrit-PatchSet: 5
      Gerrit-Owner: Meng Zhuo <m...@golangcn.org>
      Gerrit-Reviewer: Bryan C. Mills <bcm...@google.com>
      Gerrit-Reviewer: Cuong Manh Le <cuong.m...@gmail.com>
      Gerrit-Reviewer: Daniel Martí <mv...@mvdan.cc>
      Gerrit-Reviewer: Go Bot <go...@golang.org>
      Gerrit-Reviewer: Joe Tsai <joe...@google.com>
      Gerrit-Reviewer: Joe Tsai <thebroke...@gmail.com>
      Gerrit-Reviewer: Meng Zhuo <m...@golangcn.org>
      Gerrit-Attention: Daniel Martí <mv...@mvdan.cc>
      Gerrit-Attention: Meng Zhuo <m...@golangcn.org>
      Gerrit-Attention: Joe Tsai <thebroke...@gmail.com>
      Gerrit-Attention: Joe Tsai <joe...@google.com>
      Gerrit-Comment-Date: Fri, 05 Feb 2021 19:35:15 +0000

      Joe Tsai (Gerrit)

      unread,
      Feb 17, 2021, 2:57:49 PM2/17/21
      to Meng Zhuo, goph...@pubsubhelper.golang.org, Go Bot, Joe Tsai, Bryan C. Mills, Daniel Martí, Joe Tsai, Cuong Manh Le, golang-co...@googlegroups.com

      Attention is currently required from: Daniel Martí, Meng Zhuo, Joe Tsai.

      Patch set 5:Code-Review +2Trust +1

      View Change

      1 comment:

      • Patchset:

        • Patch Set #5:

          Go1.16 was just released, so we can submit this for Go1.17.

      To view, visit change 278632. To unsubscribe, or for help writing mail filters, visit settings.

      Gerrit-Project: go
      Gerrit-Branch: master
      Gerrit-Change-Id: If4bc55229b1f64b8ca4b0fed37549725efdace39
      Gerrit-Change-Number: 278632
      Gerrit-PatchSet: 5
      Gerrit-Owner: Meng Zhuo <m...@golangcn.org>
      Gerrit-Reviewer: Bryan C. Mills <bcm...@google.com>
      Gerrit-Reviewer: Cuong Manh Le <cuong.m...@gmail.com>
      Gerrit-Reviewer: Daniel Martí <mv...@mvdan.cc>
      Gerrit-Reviewer: Go Bot <go...@golang.org>
      Gerrit-Reviewer: Joe Tsai <joe...@google.com>
      Gerrit-Reviewer: Joe Tsai <thebroke...@gmail.com>
      Gerrit-Reviewer: Meng Zhuo <m...@golangcn.org>
      Gerrit-Attention: Daniel Martí <mv...@mvdan.cc>
      Gerrit-Attention: Meng Zhuo <m...@golangcn.org>
      Gerrit-Attention: Joe Tsai <joe...@google.com>
      Gerrit-Comment-Date: Wed, 17 Feb 2021 19:57:46 +0000

      Daniel Martí (Gerrit)

      unread,
      Mar 4, 2021, 5:27:33 PM3/4/21
      to Meng Zhuo, goph...@pubsubhelper.golang.org, Go Bot, Joe Tsai, Bryan C. Mills, Joe Tsai, Cuong Manh Le, golang-co...@googlegroups.com

      Attention is currently required from: Meng Zhuo, Joe Tsai.

      View Change

      1 comment:

      • Patchset:

        • Patch Set #5:

          Bump, Meng. The Gerrit emails were busted last week.

      To view, visit change 278632. To unsubscribe, or for help writing mail filters, visit settings.

      Gerrit-Project: go
      Gerrit-Branch: master
      Gerrit-Change-Id: If4bc55229b1f64b8ca4b0fed37549725efdace39
      Gerrit-Change-Number: 278632
      Gerrit-PatchSet: 5
      Gerrit-Owner: Meng Zhuo <m...@golangcn.org>
      Gerrit-Reviewer: Bryan C. Mills <bcm...@google.com>
      Gerrit-Reviewer: Cuong Manh Le <cuong.m...@gmail.com>
      Gerrit-Reviewer: Daniel Martí <mv...@mvdan.cc>
      Gerrit-Reviewer: Go Bot <go...@golang.org>
      Gerrit-Reviewer: Joe Tsai <joe...@google.com>
      Gerrit-Reviewer: Joe Tsai <thebroke...@gmail.com>
      Gerrit-Reviewer: Meng Zhuo <m...@golangcn.org>
      Gerrit-Attention: Meng Zhuo <m...@golangcn.org>
      Gerrit-Attention: Joe Tsai <joe...@google.com>
      Gerrit-Comment-Date: Thu, 04 Mar 2021 22:27:27 +0000
      Gerrit-HasComments: Yes
      Gerrit-Has-Labels: No
      Gerrit-MessageType: comment

      Meng Zhuo (Gerrit)

      unread,
      Mar 4, 2021, 9:28:04 PM3/4/21
      to Meng Zhuo, goph...@pubsubhelper.golang.org, Daniel Martí, Go Bot, Joe Tsai, Bryan C. Mills, Joe Tsai, Cuong Manh Le, golang-co...@googlegroups.com

      Attention is currently required from: Bryan C. Mills, Joe Tsai.

      View Change

      1 comment:

      • Patchset:

        • Patch Set #5:

          0.00ns/op indicates that the benchmark was not actually using b. […]

          There is no MarshalMap original bench sets. I think we are fine to fix this bug without benchmarks.

      To view, visit change 278632. To unsubscribe, or for help writing mail filters, visit settings.

      Gerrit-Project: go
      Gerrit-Branch: master
      Gerrit-Change-Id: If4bc55229b1f64b8ca4b0fed37549725efdace39
      Gerrit-Change-Number: 278632
      Gerrit-PatchSet: 5
      Gerrit-Owner: Meng Zhuo <m...@golangcn.org>
      Gerrit-Reviewer: Bryan C. Mills <bcm...@google.com>
      Gerrit-Reviewer: Cuong Manh Le <cuong.m...@gmail.com>
      Gerrit-Reviewer: Daniel Martí <mv...@mvdan.cc>
      Gerrit-Reviewer: Go Bot <go...@golang.org>
      Gerrit-Reviewer: Joe Tsai <joe...@google.com>
      Gerrit-Reviewer: Joe Tsai <thebroke...@gmail.com>
      Gerrit-Reviewer: Meng Zhuo <m...@golangcn.org>
      Gerrit-Attention: Bryan C. Mills <bcm...@google.com>
      Gerrit-Attention: Joe Tsai <joe...@google.com>
      Gerrit-Comment-Date: Fri, 05 Mar 2021 02:27:58 +0000
      Gerrit-HasComments: Yes
      Gerrit-Has-Labels: No

      Meng Zhuo (Gerrit)

      unread,
      Mar 4, 2021, 9:28:18 PM3/4/21
      to Meng Zhuo, goph...@pubsubhelper.golang.org, golang-...@googlegroups.com, Daniel Martí, Go Bot, Joe Tsai, Bryan C. Mills, Joe Tsai, Cuong Manh Le, golang-co...@googlegroups.com

      Meng Zhuo submitted this change.

      View Change

      Approvals: Joe Tsai: Looks good to me, approved; Trusted Daniel Martí: Looks good to me, approved Bryan C. Mills: Trusted Meng Zhuo: Trusted; Run TryBots Go Bot: TryBots succeeded
      encoding/json: marshal maps using reflect.Value.MapRange

      Map serialization using reflect.Value.MapIndex cannot retrieve
      map keys that contain a NaN, resulting in a panic.
      Switch the implementation to use the reflect.Value.MapRange method
      instead, which iterates over all map entries regardless of whether
      they are directly retrievable.

      Note that according to RFC 8259, section 4, a JSON object should
      have unique names, but does not forbid the occurrence of duplicate names.

      Fixes #43207

      Change-Id: If4bc55229b1f64b8ca4b0fed37549725efdace39
      Reviewed-on: https://go-review.googlesource.com/c/go/+/278632
      Trust: Meng Zhuo <m...@golangcn.org>
      Trust: Joe Tsai <thebroke...@gmail.com>
      Trust: Bryan C. Mills <bcm...@google.com>
      Run-TryBot: Meng Zhuo <m...@golangcn.org>
      TryBot-Result: Go Bot <go...@golang.org>
      Reviewed-by: Joe Tsai <thebroke...@gmail.com>
      Reviewed-by: Daniel Martí <mv...@mvdan.cc>

      ---
      M src/encoding/json/encode.go
      M src/encoding/json/encode_test.go
      2 files changed, 40 insertions(+), 17 deletions(-)

      diff --git a/src/encoding/json/encode.go b/src/encoding/json/encode.go
      index 751f03d..e473e61 100644
      --- a/src/encoding/json/encode.go
      +++ b/src/encoding/json/encode.go
      @@ -794,23 +794,24 @@
      e.WriteByte('{')

      // Extract and sort the keys.
      - keys := v.MapKeys()
      - sv := make([]reflectWithString, len(keys))
      - for i, v := range keys {
      - sv[i].v = v
      + sv := make([]reflectWithString, v.Len())
      + mi := v.MapRange()
      + for i := 0; mi.Next(); i++ {
      + sv[i].k = mi.Key()
      + sv[i].v = mi.Value()
      if err := sv[i].resolve(); err != nil {
      e.error(fmt.Errorf("json: encoding error for type %q: %q", v.Type().String(), err.Error()))
      }
      }
      - sort.Slice(sv, func(i, j int) bool { return sv[i].s < sv[j].s })
      + sort.Slice(sv, func(i, j int) bool { return sv[i].ks < sv[j].ks })

      for i, kv := range sv {
      if i > 0 {
      e.WriteByte(',')
      }
      - e.string(kv.s, opts.escapeHTML)
      + e.string(kv.ks, opts.escapeHTML)
      e.WriteByte(':')
      - me.elemEnc(e, v.MapIndex(kv.v), opts)
      + me.elemEnc(e, kv.v, opts)
      }
      e.WriteByte('}')
      e.ptrLevel--
      @@ -997,29 +998,30 @@
      }

      type reflectWithString struct {
      - v reflect.Value
      - s string
      + k reflect.Value
      + v reflect.Value
      + ks string
      }

      func (w *reflectWithString) resolve() error {
      - if w.v.Kind() == reflect.String {
      - w.s = w.v.String()
      + if w.k.Kind() == reflect.String {
      + w.ks = w.k.String()
      return nil
      }
      - if tm, ok := w.v.Interface().(encoding.TextMarshaler); ok {
      - if w.v.Kind() == reflect.Ptr && w.v.IsNil() {
      + if tm, ok := w.k.Interface().(encoding.TextMarshaler); ok {
      + if w.k.Kind() == reflect.Ptr && w.k.IsNil() {
      return nil
      }
      buf, err := tm.MarshalText()
      - w.s = string(buf)
      + w.ks = string(buf)
      return err
      }
      - switch w.v.Kind() {
      + switch w.k.Kind() {
      case reflect.Int, reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64:
      - w.s = strconv.FormatInt(w.v.Int(), 10)
      + w.ks = strconv.FormatInt(w.k.Int(), 10)
      return nil
      case reflect.Uint, reflect.Uint8, reflect.Uint16, reflect.Uint32, reflect.Uint64, reflect.Uintptr:
      - w.s = strconv.FormatUint(w.v.Uint(), 10)
      + w.ks = strconv.FormatUint(w.k.Uint(), 10)
      return nil
      }
      panic("unexpected map key type")
      diff --git a/src/encoding/json/encode_test.go b/src/encoding/json/encode_test.go
      index 42bb09d..0dad951 100644
      --- a/src/encoding/json/encode_test.go
      +++ b/src/encoding/json/encode_test.go
      @@ -245,6 +245,22 @@
      }
      }

      +// Issue 43207
      +func TestMarshalTextFloatMap(t *testing.T) {
      + m := map[textfloat]string{
      + textfloat(math.NaN()): "1",
      + textfloat(math.NaN()): "1",
      + }
      + got, err := Marshal(m)
      + if err != nil {
      + t.Errorf("Marshal() error: %v", err)
      + }
      + want := `{"TF:NaN":"1","TF:NaN":"1"}`
      + if string(got) != want {
      + t.Errorf("Marshal() = %s, want %s", got, want)
      + }
      +}
      +
      // Ref has Marshaler and Unmarshaler methods with pointer receiver.
      type Ref int

      @@ -854,6 +870,10 @@
      return buf.Bytes(), nil
      }

      +type textfloat float64
      +
      +func (f textfloat) MarshalText() ([]byte, error) { return tenc(`TF:%0.2f`, f) }
      +
      // Issue 13783
      func TestEncodeBytekind(t *testing.T) {
      testdata := []struct {
      @@ -872,6 +892,7 @@
      {[]jsonint{5, 4}, `[{"JI":5},{"JI":4}]`},
      {[]textint{9, 3}, `["TI:9","TI:3"]`},
      {[]int{9, 3}, `[9,3]`},
      + {[]textfloat{12, 3}, `["TF:12.00","TF:3.00"]`},
      }
      for _, d := range testdata {
      js, err := Marshal(d.data)

      To view, visit change 278632. To unsubscribe, or for help writing mail filters, visit settings.

      Gerrit-Project: go
      Gerrit-Branch: master
      Gerrit-Change-Id: If4bc55229b1f64b8ca4b0fed37549725efdace39
      Gerrit-Change-Number: 278632
      Gerrit-PatchSet: 6
      Gerrit-Owner: Meng Zhuo <m...@golangcn.org>
      Gerrit-Reviewer: Bryan C. Mills <bcm...@google.com>
      Gerrit-Reviewer: Cuong Manh Le <cuong.m...@gmail.com>
      Gerrit-Reviewer: Daniel Martí <mv...@mvdan.cc>
      Gerrit-Reviewer: Go Bot <go...@golang.org>
      Gerrit-Reviewer: Joe Tsai <joe...@google.com>
      Gerrit-Reviewer: Joe Tsai <thebroke...@gmail.com>
      Gerrit-Reviewer: Meng Zhuo <m...@golangcn.org>
      Gerrit-MessageType: merged
      Reply all
      Reply to author
      Forward
      0 new messages