[go] encoding/json: add omitzero option

29 views
Skip to first unread message

Gerrit Bot (Gerrit)

unread,
Sep 25, 2024, 8:27:18 AM9/25/24
to goph...@pubsubhelper.golang.org, Jes Cok, golang-co...@googlegroups.com

Gerrit Bot has uploaded the change for review

Commit message

encoding/json: add omitzero option

Fixes #45669
Change-Id: Ic13523c0b3acdfc5b3e29a717bc62fde302ed8fd
GitHub-Last-Rev: aacdc51a82e77cbf6f9c652ca3fba3d9fb358315
GitHub-Pull-Request: golang/go#69622

Change diff

diff --git a/doc/next/6-stdlib/99-minor/encoding/json/45669.md b/doc/next/6-stdlib/99-minor/encoding/json/45669.md
new file mode 100644
index 0000000..ec18cce
--- /dev/null
+++ b/doc/next/6-stdlib/99-minor/encoding/json/45669.md
@@ -0,0 +1,11 @@
+When marshaling, the `omitzero` option specifies that the struct field should be
+omitted if the field value is zero as determined by the `IsZero() bool` method
+if present, otherwise based on whether the field is the zero Go value (according
+to [reflect.Value.IsZero]).
+
+This option has no effect when unmarshaling. If `omitempty` is specified together
+with `omitzero`, whether a field is omitted is based on the logical OR of the two.
+
+This will mean that `omitzero` of a slice omits a nil slice but emits [] for a
+zero-length non-nil slice (and similar for maps). It will also mean that
+`omitzero` of a [time.Time] omits time.Time{}.
\ No newline at end of file
diff --git a/src/encoding/json/encode.go b/src/encoding/json/encode.go
index 988de71..671cd3f 100644
--- a/src/encoding/json/encode.go
+++ b/src/encoding/json/encode.go
@@ -318,6 +318,17 @@
return false
}

+type zeroable interface {
+ IsZero() bool
+}
+
+func isZeroValue(v reflect.Value) bool {
+ if z, ok := v.Interface().(zeroable); ok {
+ return z.IsZero()
+ }
+ return v.IsZero()
+}
+
func (e *encodeState) reflectValue(v reflect.Value, opts encOpts) {
valueEncoder(v)(e, v, opts)
}
@@ -701,7 +712,8 @@
fv = fv.Field(i)
}

- if f.omitEmpty && isEmptyValue(fv) {
+ if (f.omitEmpty && isEmptyValue(fv)) ||
+ (f.omitZero && isZeroValue(fv)) {
continue
}
e.WriteByte(next)
@@ -1048,6 +1060,7 @@
index []int
typ reflect.Type
omitEmpty bool
+ omitZero bool
quoted bool

encoder encoderFunc
@@ -1154,6 +1167,7 @@
index: index,
typ: ft,
omitEmpty: opts.Contains("omitempty"),
+ omitZero: opts.Contains("omitzero"),
quoted: quoted,
}
field.nameBytes = []byte(field.name)
diff --git a/src/encoding/json/encode_test.go b/src/encoding/json/encode_test.go
index 23a14d0..388d4dd 100644
--- a/src/encoding/json/encode_test.go
+++ b/src/encoding/json/encode_test.go
@@ -15,9 +15,10 @@
"runtime/debug"
"strconv"
"testing"
+ "time"
)

-type Optionals struct {
+type OptionalsEmpty struct {
Sr string `json:"sr"`
So string `json:"so,omitempty"`
Sw string `json:"-"`
@@ -56,7 +57,7 @@
"str": {},
"sto": {}
}`
- var o Optionals
+ var o OptionalsEmpty
o.Sw = "something"
o.Mr = map[string]any{}
o.Mo = map[string]any{}
@@ -70,6 +71,120 @@
}
}

+type OptionalsZero struct {
+ Sr string `json:"sr"`
+ So string `json:"so,omitzero"`
+ Sw string `json:"-"`
+
+ Ir int `json:"omitempty"` // actually named omitempty, not an option
+ Io int `json:"io,omitzero"`
+
+ Slr []string `json:"slr,random"`
+ Slo []string `json:"slo,omitzero"`
+ SloNonNil []string `json:"slononnil,omitzero"`
+
+ Mr map[string]any `json:"mr"`
+ Mo map[string]any `json:",omitzero"`
+
+ Fr float64 `json:"fr"`
+ Fo float64 `json:"fo,omitzero"`
+
+ Br bool `json:"br"`
+ Bo bool `json:"bo,omitzero"`
+
+ Ur uint `json:"ur"`
+ Uo uint `json:"uo,omitzero"`
+
+ Str struct{} `json:"str"`
+ Sto struct{} `json:"sto,omitzero"`
+
+ MyTime time.Time `json:"mytime,omitzero"`
+}
+
+func TestOmitZero(t *testing.T) {
+ var want = `{
+ "sr": "",
+ "omitempty": 0,
+ "slr": null,
+ "slononnil": [],
+ "mr": {},
+ "Mo": {},
+ "fr": 0,
+ "br": false,
+ "ur": 0,
+ "str": {}
+}`
+ var o OptionalsZero
+ o.Sw = "something"
+ o.SloNonNil = make([]string, 0)
+ o.Mr = map[string]any{}
+ o.Mo = map[string]any{}
+
+ got, err := MarshalIndent(&o, "", " ")
+ if err != nil {
+ t.Fatalf("MarshalIndent error: %v", err)
+ }
+ if got := string(got); got != want {
+ t.Errorf("MarshalIndent:\n\tgot: %s\n\twant: %s\n", indentNewlines(got), indentNewlines(want))
+ }
+}
+
+type OptionalsEmptyZero struct {
+ Sr string `json:"sr"`
+ So string `json:"so,omitempty,omitzero"`
+ Sw string `json:"-"`
+
+ Ir int `json:"omitempty"` // actually named omitempty, not an option
+ Io int `json:"io,omitempty,omitzero"`
+
+ Slr []string `json:"slr,random"`
+ Slo []string `json:"slo,omitempty,omitzero"`
+ SloNonNil []string `json:"slononnil,omitempty,omitzero"`
+
+ Mr map[string]any `json:"mr"`
+ Mo map[string]any `json:",omitempty,omitzero"`
+
+ Fr float64 `json:"fr"`
+ Fo float64 `json:"fo,omitempty,omitzero"`
+
+ Br bool `json:"br"`
+ Bo bool `json:"bo,omitempty,omitzero"`
+
+ Ur uint `json:"ur"`
+ Uo uint `json:"uo,omitempty,omitzero"`
+
+ Str struct{} `json:"str"`
+ Sto struct{} `json:"sto,omitempty,omitzero"`
+
+ MyTime time.Time `json:"mytime,omitempty,omitzero"`
+}
+
+func TestOmitEmptyZero(t *testing.T) {
+ var want = `{
+ "sr": "",
+ "omitempty": 0,
+ "slr": null,
+ "mr": {},
+ "fr": 0,
+ "br": false,
+ "ur": 0,
+ "str": {}
+}`
+ var o OptionalsEmptyZero
+ o.Sw = "something"
+ o.SloNonNil = make([]string, 0)
+ o.Mr = map[string]any{}
+ o.Mo = map[string]any{}
+
+ got, err := MarshalIndent(&o, "", " ")
+ if err != nil {
+ t.Fatalf("MarshalIndent error: %v", err)
+ }
+ if got := string(got); got != want {
+ t.Errorf("MarshalIndent:\n\tgot: %s\n\twant: %s\n", indentNewlines(got), indentNewlines(want))
+ }
+}
+
type StringTag struct {
BoolStr bool `json:",string"`
IntStr int64 `json:",string"`

Change information

Files:
  • A doc/next/6-stdlib/99-minor/encoding/json/45669.md
  • M src/encoding/json/encode.go
  • M src/encoding/json/encode_test.go
Change size: M
Delta: 3 files changed, 143 insertions(+), 3 deletions(-)
Open in Gerrit

Related details

Attention set is empty
Submit Requirements:
  • requirement is not satisfiedCode-Review
  • requirement satisfiedNo-Unresolved-Comments
  • requirement is not satisfiedReview-Enforcement
  • requirement is not satisfiedTryBots-Pass
Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
Gerrit-MessageType: newchange
Gerrit-Project: go
Gerrit-Branch: master
Gerrit-Change-Id: Ic13523c0b3acdfc5b3e29a717bc62fde302ed8fd
Gerrit-Change-Number: 615676
Gerrit-PatchSet: 1
Gerrit-Owner: Gerrit Bot <letsus...@gmail.com>
Gerrit-CC: Jes Cok <xigua...@gmail.com>
unsatisfied_requirement
satisfied_requirement
open
diffy

Gopher Robot (Gerrit)

unread,
Sep 25, 2024, 8:27:19 AM9/25/24
to Jes Cok, Gerrit Bot, goph...@pubsubhelper.golang.org, golang-co...@googlegroups.com

Gopher Robot added 1 comment

Patchset-level comments
File-level comment, Patchset 1 (Latest):
Gopher Robot . unresolved

I spotted some possible problems.

These findings are based on simple heuristics. If a finding appears wrong, briefly reply here saying so. Otherwise, please address any problems and update the GitHub PR. When complete, mark this comment as 'Done' and click the [blue 'Reply' button](https://go.dev/wiki/GerritBot#i-left-a-reply-to-a-comment-in-gerrit-but-no-one-but-me-can-see-it) above.

Possible problems detected:
1. The commit message body is very brief. That can be OK if the change is trivial like correcting spelling or fixing a broken link, but usually the description should provide context for the change and explain what it does in complete sentences.

The commit title and commit message body come from the GitHub PR title and description, and must be edited in the GitHub web interface (not via git). For instructions, see [here](https://go.dev/wiki/GerritBot/#how-does-gerritbot-determine-the-final-commit-message). For guidelines on commit messages for the Go project, see [here](https://go.dev/doc/contribute#commit_messages).


(In general for Gerrit code reviews, the change author is expected to [log in to Gerrit](https://go-review.googlesource.com/login/) with a Gmail or other Google account and then close out each piece of feedback by marking it as 'Done' if implemented as suggested or otherwise reply to each review comment. See the [Review](https://go.dev/doc/contribute#review) section of the Contributing Guide for details.)

Open in Gerrit

Related details

Attention set is empty
Submit Requirements:
    • requirement is not satisfiedCode-Review
    • requirement is not satisfiedNo-Unresolved-Comments
    • requirement is not satisfiedReview-Enforcement
    • requirement is not satisfiedTryBots-Pass
    Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
    Gerrit-MessageType: comment
    Gerrit-Project: go
    Gerrit-Branch: master
    Gerrit-Change-Id: Ic13523c0b3acdfc5b3e29a717bc62fde302ed8fd
    Gerrit-Change-Number: 615676
    Gerrit-PatchSet: 1
    Gerrit-Owner: Gerrit Bot <letsus...@gmail.com>
    Gerrit-CC: Gopher Robot <go...@golang.org>
    Gerrit-CC: Jes Cok <xigua...@gmail.com>
    Gerrit-Comment-Date: Wed, 25 Sep 2024 12:27:14 +0000
    Gerrit-HasComments: Yes
    Gerrit-Has-Labels: No
    unsatisfied_requirement
    open
    diffy

    Ian Lance Taylor (Gerrit)

    unread,
    Sep 25, 2024, 9:54:36 AM9/25/24
    to Jes Cok, Gerrit Bot, goph...@pubsubhelper.golang.org, Ian Lance Taylor, Russ Cox, Joseph Tsai, Brad Fitzpatrick, Daniel Martí, Gopher Robot, golang-co...@googlegroups.com
    Attention needed from Russ Cox

    Ian Lance Taylor added 5 comments

    File doc/next/6-stdlib/99-minor/encoding/json/45669.md
    Line 2, Patchset 1 (Latest):omitted if the field value is zero as determined by the `IsZero() bool` method
    Ian Lance Taylor . unresolved

    When marshaling, a struct field with the new `omitzero` option in the struct field tag will be omitted if its value is zero. If the field type has an `IsZero() bool` method, that will be used to determine whether the value is zero. Otherwise, the value is zero if it is [the zero value for its type](/ref/spec#The_zero_value).

    Line 6, Patchset 1 (Latest):This option has no effect when unmarshaling. If `omitempty` is specified together
    Ian Lance Taylor . unresolved

    The omitempty sentence should be a new paragraph.

    Line 7, Patchset 1 (Latest):with `omitzero`, whether a field is omitted is based on the logical OR of the two.
    Ian Lance Taylor . unresolved

    If both omitempty and omitzero are specified, the field will be omitted if the value is either empty or zero (or both).

    Line 9, Patchset 1 (Latest):This will mean that `omitzero` of a slice omits a nil slice but emits [] for a
    Ian Lance Taylor . unresolved

    I don't think we need this paragraph in the release notes. The release notes should point out the change; explanatory details belong in the regular documentation and/or examples.

    File src/encoding/json/encode.go
    Line 73, Patchset 1 (Latest):// The "omitempty" option specifies that the field should be omitted
    Ian Lance Taylor . unresolved

    The new omitzero option needs to be documented up here.

    Open in Gerrit

    Related details

    Attention is currently required from:
    • Russ Cox
    Submit Requirements:
    • requirement is not satisfiedCode-Review
    • requirement is not satisfiedNo-Unresolved-Comments
    • requirement is not satisfiedReview-Enforcement
    • requirement is not satisfiedTryBots-Pass
    Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
    Gerrit-MessageType: comment
    Gerrit-Project: go
    Gerrit-Branch: master
    Gerrit-Change-Id: Ic13523c0b3acdfc5b3e29a717bc62fde302ed8fd
    Gerrit-Change-Number: 615676
    Gerrit-PatchSet: 1
    Gerrit-Owner: Gerrit Bot <letsus...@gmail.com>
    Gerrit-Reviewer: Russ Cox <r...@golang.org>
    Gerrit-CC: Brad Fitzpatrick <brad...@golang.org>
    Gerrit-CC: Daniel Martí <mv...@mvdan.cc>
    Gerrit-CC: Gopher Robot <go...@golang.org>
    Gerrit-CC: Ian Lance Taylor <ia...@golang.org>
    Gerrit-CC: Jes Cok <xigua...@gmail.com>
    Gerrit-CC: Joseph Tsai <joe...@digital-static.net>
    Gerrit-Attention: Russ Cox <r...@golang.org>
    Gerrit-Comment-Date: Wed, 25 Sep 2024 13:54:27 +0000
    Gerrit-HasComments: Yes
    Gerrit-Has-Labels: No
    unsatisfied_requirement
    open
    diffy

    Gerrit Bot (Gerrit)

    unread,
    Sep 26, 2024, 8:56:16 AM9/26/24
    to Jes Cok, goph...@pubsubhelper.golang.org, golang-co...@googlegroups.com
    Attention needed from Russ Cox

    Gerrit Bot uploaded new patchset

    Gerrit Bot uploaded patch set #2 to this change.
    Open in Gerrit

    Related details

    Attention is currently required from:
    • Russ Cox
    Submit Requirements:
    • requirement is not satisfiedCode-Review
    • requirement is not satisfiedNo-Unresolved-Comments
    • requirement is not satisfiedReview-Enforcement
    • requirement is not satisfiedTryBots-Pass
    Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
    Gerrit-MessageType: newpatchset
    Gerrit-Project: go
    Gerrit-Branch: master
    Gerrit-Change-Id: Ic13523c0b3acdfc5b3e29a717bc62fde302ed8fd
    Gerrit-Change-Number: 615676
    Gerrit-PatchSet: 2
    unsatisfied_requirement
    open
    diffy

    Gerrit Bot (Gerrit)

    unread,
    Sep 26, 2024, 9:12:19 AM9/26/24
    to Jes Cok, goph...@pubsubhelper.golang.org, golang-co...@googlegroups.com
    Attention needed from Russ Cox

    Gerrit Bot uploaded new patchset

    Gerrit Bot uploaded patch set #3 to this change.
    Open in Gerrit

    Related details

    Attention is currently required from:
    • Russ Cox
    Submit Requirements:
    • requirement is not satisfiedCode-Review
    • requirement is not satisfiedNo-Unresolved-Comments
    • requirement is not satisfiedReview-Enforcement
    • requirement is not satisfiedTryBots-Pass
    Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
    Gerrit-MessageType: newpatchset
    Gerrit-Project: go
    Gerrit-Branch: master
    Gerrit-Change-Id: Ic13523c0b3acdfc5b3e29a717bc62fde302ed8fd
    Gerrit-Change-Number: 615676
    Gerrit-PatchSet: 3
    unsatisfied_requirement
    open
    diffy

    Ian Lance Taylor (Gerrit)

    unread,
    Sep 26, 2024, 9:52:32 AM9/26/24
    to Jes Cok, Gerrit Bot, goph...@pubsubhelper.golang.org, Ian Lance Taylor, Russ Cox, Joseph Tsai, Brad Fitzpatrick, Daniel Martí, Gopher Robot, golang-co...@googlegroups.com
    Attention needed from Russ Cox

    Ian Lance Taylor added 6 comments

    File doc/next/6-stdlib/99-minor/encoding/json/45669.md
    Line 2, Patchset 1:omitted if the field value is zero as determined by the `IsZero() bool` method
    Ian Lance Taylor . resolved

    When marshaling, a struct field with the new `omitzero` option in the struct field tag will be omitted if its value is zero. If the field type has an `IsZero() bool` method, that will be used to determine whether the value is zero. Otherwise, the value is zero if it is [the zero value for its type](/ref/spec#The_zero_value).

    Ian Lance Taylor

    Done

    Line 6, Patchset 1:This option has no effect when unmarshaling. If `omitempty` is specified together
    Ian Lance Taylor . resolved

    The omitempty sentence should be a new paragraph.

    Ian Lance Taylor

    Done

    Line 7, Patchset 1:with `omitzero`, whether a field is omitted is based on the logical OR of the two.
    Ian Lance Taylor . resolved

    If both omitempty and omitzero are specified, the field will be omitted if the value is either empty or zero (or both).

    Ian Lance Taylor

    Done

    Line 9, Patchset 1:This will mean that `omitzero` of a slice omits a nil slice but emits [] for a
    Ian Lance Taylor . resolved

    I don't think we need this paragraph in the release notes. The release notes should point out the change; explanatory details belong in the regular documentation and/or examples.

    Ian Lance Taylor

    Done

    File src/encoding/json/encode.go
    Line 73, Patchset 1:// The "omitempty" option specifies that the field should be omitted
    Ian Lance Taylor . resolved

    The new omitzero option needs to be documented up here.

    Ian Lance Taylor

    Done

    Line 110, Patchset 3 (Latest):// Examples of struct field tags and their meanings:
    Ian Lance Taylor . unresolved

    These examples don't add much. They just repeat the omitempty examples. Let's omit them.

    Open in Gerrit

    Related details

    Attention is currently required from:
    • Russ Cox
    Submit Requirements:
    • requirement is not satisfiedCode-Review
    • requirement is not satisfiedNo-Unresolved-Comments
    • requirement is not satisfiedReview-Enforcement
    • requirement is not satisfiedTryBots-Pass
    Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
    Gerrit-MessageType: comment
    Gerrit-Project: go
    Gerrit-Branch: master
    Gerrit-Change-Id: Ic13523c0b3acdfc5b3e29a717bc62fde302ed8fd
    Gerrit-Change-Number: 615676
    Gerrit-PatchSet: 3
    Gerrit-Owner: Gerrit Bot <letsus...@gmail.com>
    Gerrit-Reviewer: Russ Cox <r...@golang.org>
    Gerrit-CC: Brad Fitzpatrick <brad...@golang.org>
    Gerrit-CC: Daniel Martí <mv...@mvdan.cc>
    Gerrit-CC: Gopher Robot <go...@golang.org>
    Gerrit-CC: Ian Lance Taylor <ia...@golang.org>
    Gerrit-CC: Jes Cok <xigua...@gmail.com>
    Gerrit-CC: Joseph Tsai <joe...@digital-static.net>
    Gerrit-Attention: Russ Cox <r...@golang.org>
    Gerrit-Comment-Date: Thu, 26 Sep 2024 13:52:24 +0000
    Gerrit-HasComments: Yes
    Gerrit-Has-Labels: No
    Comment-In-Reply-To: Ian Lance Taylor <ia...@golang.org>
    unsatisfied_requirement
    open
    diffy

    Gerrit Bot (Gerrit)

    unread,
    Sep 26, 2024, 10:30:49 AM9/26/24
    to Jes Cok, goph...@pubsubhelper.golang.org, golang-co...@googlegroups.com
    Attention needed from Russ Cox

    Gerrit Bot uploaded new patchset

    Gerrit Bot uploaded patch set #4 to this change.
    Open in Gerrit

    Related details

    Attention is currently required from:
    • Russ Cox
    Submit Requirements:
    • requirement is not satisfiedCode-Review
    • requirement is not satisfiedNo-Unresolved-Comments
    • requirement is not satisfiedReview-Enforcement
    • requirement is not satisfiedTryBots-Pass
    Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
    Gerrit-MessageType: newpatchset
    Gerrit-Project: go
    Gerrit-Branch: master
    Gerrit-Change-Id: Ic13523c0b3acdfc5b3e29a717bc62fde302ed8fd
    Gerrit-Change-Number: 615676
    Gerrit-PatchSet: 4
    unsatisfied_requirement
    open
    diffy

    Ian Lance Taylor (Gerrit)

    unread,
    Sep 26, 2024, 4:58:15 PM9/26/24
    to Jes Cok, Gerrit Bot, goph...@pubsubhelper.golang.org, Ian Lance Taylor, Russ Cox, Joseph Tsai, Brad Fitzpatrick, Daniel Martí, Gopher Robot, golang-co...@googlegroups.com
    Attention needed from Russ Cox

    Ian Lance Taylor voted and added 1 comment

    Votes added by Ian Lance Taylor

    Commit-Queue+1

    1 comment

    File src/encoding/json/encode.go
    Line 110, Patchset 3:// Examples of struct field tags and their meanings:
    Ian Lance Taylor . resolved

    These examples don't add much. They just repeat the omitempty examples. Let's omit them.

    Ian Lance Taylor

    Done

    Open in Gerrit

    Related details

    Attention is currently required from:
    • Russ Cox
    Submit Requirements:
    • requirement is not satisfiedCode-Review
    • requirement is not satisfiedNo-Unresolved-Comments
    • requirement is not satisfiedReview-Enforcement
    • requirement is not satisfiedTryBots-Pass
    Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
    Gerrit-MessageType: comment
    Gerrit-Project: go
    Gerrit-Branch: master
    Gerrit-Change-Id: Ic13523c0b3acdfc5b3e29a717bc62fde302ed8fd
    Gerrit-Change-Number: 615676
    Gerrit-PatchSet: 4
    Gerrit-Owner: Gerrit Bot <letsus...@gmail.com>
    Gerrit-Reviewer: Ian Lance Taylor <ia...@golang.org>
    Gerrit-Reviewer: Russ Cox <r...@golang.org>
    Gerrit-CC: Brad Fitzpatrick <brad...@golang.org>
    Gerrit-CC: Daniel Martí <mv...@mvdan.cc>
    Gerrit-CC: Gopher Robot <go...@golang.org>
    Gerrit-CC: Jes Cok <xigua...@gmail.com>
    Gerrit-CC: Joseph Tsai <joe...@digital-static.net>
    Gerrit-Attention: Russ Cox <r...@golang.org>
    Gerrit-Comment-Date: Thu, 26 Sep 2024 20:58:08 +0000
    Gerrit-HasComments: Yes
    Gerrit-Has-Labels: Yes
    unsatisfied_requirement
    open
    diffy

    Ian Lance Taylor (Gerrit)

    unread,
    Sep 26, 2024, 6:30:54 PM9/26/24
    to Jes Cok, Gerrit Bot, goph...@pubsubhelper.golang.org, Go LUCI, Ian Lance Taylor, Russ Cox, Joseph Tsai, Brad Fitzpatrick, Daniel Martí, Gopher Robot, golang-co...@googlegroups.com
    Attention needed from Russ Cox

    Ian Lance Taylor voted and added 1 comment

    Votes added by Ian Lance Taylor

    Auto-Submit+1
    Code-Review+2
    Commit-Queue+1

    1 comment

    Patchset-level comments
    Ian Lance Taylor . resolved

    Related details

    Attention is currently required from:
    • Russ Cox
    Submit Requirements:
    • requirement satisfiedCode-Review
    • requirement is not satisfiedNo-Unresolved-Comments
    • requirement is not satisfiedReview-Enforcement
    • requirement satisfiedTryBots-Pass
    Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
    Gerrit-MessageType: comment
    Gerrit-Project: go
    Gerrit-Branch: master
    Gerrit-Change-Id: Ic13523c0b3acdfc5b3e29a717bc62fde302ed8fd
    Gerrit-Change-Number: 615676
    Gerrit-PatchSet: 4
    Gerrit-Owner: Gerrit Bot <letsus...@gmail.com>
    Gerrit-Reviewer: Ian Lance Taylor <ia...@golang.org>
    Gerrit-Reviewer: Ian Lance Taylor <ia...@google.com>
    Gerrit-Reviewer: Russ Cox <r...@golang.org>
    Gerrit-CC: Brad Fitzpatrick <brad...@golang.org>
    Gerrit-CC: Daniel Martí <mv...@mvdan.cc>
    Gerrit-CC: Gopher Robot <go...@golang.org>
    Gerrit-CC: Jes Cok <xigua...@gmail.com>
    Gerrit-CC: Joseph Tsai <joe...@digital-static.net>
    Gerrit-Attention: Russ Cox <r...@golang.org>
    Gerrit-Comment-Date: Thu, 26 Sep 2024 22:30:47 +0000
    Gerrit-HasComments: Yes
    Gerrit-Has-Labels: Yes
    satisfied_requirement
    unsatisfied_requirement
    open
    diffy

    Joe Tsai (Gerrit)

    unread,
    Sep 26, 2024, 6:47:45 PM9/26/24
    to Jes Cok, Gerrit Bot, goph...@pubsubhelper.golang.org, Joe Tsai, Go LUCI, Ian Lance Taylor, Russ Cox, Joseph Tsai, Brad Fitzpatrick, Daniel Martí, Gopher Robot, golang-co...@googlegroups.com
    Attention needed from Russ Cox

    Joe Tsai added 1 comment

    File src/encoding/json/encode.go
    Line 332, Patchset 4 (Latest):func isZeroValue(v reflect.Value) bool {
    if z, ok := v.Interface().(interface {
    IsZero() bool
    }); ok {
    return z.IsZero()
    }
    return v.IsZero()
    }
    Joe Tsai . unresolved

    While this is nice, concise, and simple, it unfortunately doesn't handle a few edge cases in particular with nil interfaces, nil pointers, and addressability.

    The exact implementation that the "github.com/go-json-experiment/json" uses is here:
    https://github.com/go-json-experiment/json/blob/ebd3a8989ca1eadb7a68e02a93448ecbbab5900c/fields.go#L167-L184

    It's open to debate whether we should call IsZero on nil pointers, but we decided not to do so to avoid a possible nil pointer panic, which could be fatal in JSON marshaling/unmarshaling. I can't imagine a use-case where an IsZero method reports false on a nil-pointer receiver. However, there exist implementations of IsZero defined on a pointer receiver that also forgot to check whether it is in.

    Also, we should check whether the pointer version of T also implements IsZero. This would be similar to how MarshalJSON and MarshalText defined on (*T) is inconsistently called because they have struct field that is of type T. This is not people expect and a source of many bugs.

    Gerrit-CC: Joe Tsai <thebroke...@gmail.com>
    Gerrit-CC: Joseph Tsai <joe...@digital-static.net>
    Gerrit-Attention: Russ Cox <r...@golang.org>
    Gerrit-Comment-Date: Thu, 26 Sep 2024 22:47:33 +0000
    Gerrit-HasComments: Yes
    Gerrit-Has-Labels: No
    satisfied_requirement
    unsatisfied_requirement
    open
    diffy

    Ian Lance Taylor (Gerrit)

    unread,
    Sep 26, 2024, 6:54:13 PM9/26/24
    to Jes Cok, Gerrit Bot, goph...@pubsubhelper.golang.org, Joe Tsai, Go LUCI, Ian Lance Taylor, Russ Cox, Joseph Tsai, Brad Fitzpatrick, Daniel Martí, Gopher Robot, golang-co...@googlegroups.com
    Attention needed from Russ Cox

    Ian Lance Taylor voted

    Auto-Submit+0
    Code-Review+0
    Commit-Queue+1
    Open in Gerrit

    Related details

    Attention is currently required from:
    • Russ Cox
    Submit Requirements:
    • requirement is not satisfiedCode-Review
    • requirement is not satisfiedNo-Unresolved-Comments
    • requirement is not satisfiedReview-Enforcement
    • requirement satisfiedTryBots-Pass
    Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
    Gerrit-MessageType: comment
    Gerrit-Project: go
    Gerrit-Branch: master
    Gerrit-Change-Id: Ic13523c0b3acdfc5b3e29a717bc62fde302ed8fd
    Gerrit-Change-Number: 615676
    Gerrit-PatchSet: 4
    Gerrit-Owner: Gerrit Bot <letsus...@gmail.com>
    Gerrit-Reviewer: Ian Lance Taylor <ia...@golang.org>
    Gerrit-Reviewer: Ian Lance Taylor <ia...@google.com>
    Gerrit-Reviewer: Russ Cox <r...@golang.org>
    Gerrit-CC: Brad Fitzpatrick <brad...@golang.org>
    Gerrit-CC: Daniel Martí <mv...@mvdan.cc>
    Gerrit-CC: Gopher Robot <go...@golang.org>
    Gerrit-CC: Jes Cok <xigua...@gmail.com>
    Gerrit-CC: Joe Tsai <thebroke...@gmail.com>
    Gerrit-CC: Joseph Tsai <joe...@digital-static.net>
    Gerrit-Attention: Russ Cox <r...@golang.org>
    Gerrit-Comment-Date: Thu, 26 Sep 2024 22:54:06 +0000
    Gerrit-HasComments: No
    Gerrit-Has-Labels: Yes
    unsatisfied_requirement
    satisfied_requirement
    open
    diffy

    Joe Tsai (Gerrit)

    unread,
    Sep 26, 2024, 7:27:21 PM9/26/24
    to Jes Cok, Gerrit Bot, goph...@pubsubhelper.golang.org, Joe Tsai, Go LUCI, Ian Lance Taylor, Russ Cox, Joseph Tsai, Brad Fitzpatrick, Daniel Martí, Gopher Robot, golang-co...@googlegroups.com
    Attention needed from Russ Cox

    Joe Tsai added 1 comment

    File src/encoding/json/encode.go
    Line 332, Patchset 4 (Latest):func isZeroValue(v reflect.Value) bool {
    if z, ok := v.Interface().(interface {
    IsZero() bool
    }); ok {
    return z.IsZero()
    }
    return v.IsZero()
    }
    Joe Tsai . unresolved

    While this is nice, concise, and simple, it unfortunately doesn't handle a few edge cases in particular with nil interfaces, nil pointers, and addressability.

    The exact implementation that the "github.com/go-json-experiment/json" uses is here:
    https://github.com/go-json-experiment/json/blob/ebd3a8989ca1eadb7a68e02a93448ecbbab5900c/fields.go#L167-L184

    It's open to debate whether we should call IsZero on nil pointers, but we decided not to do so to avoid a possible nil pointer panic, which could be fatal in JSON marshaling/unmarshaling. I can't imagine a use-case where an IsZero method reports false on a nil-pointer receiver. However, there exist implementations of IsZero defined on a pointer receiver that also forgot to check whether it is in.

    Also, we should check whether the pointer version of T also implements IsZero. This would be similar to how MarshalJSON and MarshalText defined on (*T) is inconsistently called because they have struct field that is of type T. This is not people expect and a source of many bugs.

    Joe Tsai

    I just did a static analysis of all open-source Go code of all `func (*T) IsZero() bool` methods and unfortunately it seems ~85% of them would panic if called on a nil *T, which is worse than I suspected, so that lends credibility to special-casing *T.

    Gerrit-Comment-Date: Thu, 26 Sep 2024 23:27:09 +0000
    Gerrit-HasComments: Yes
    Gerrit-Has-Labels: No
    Comment-In-Reply-To: Joe Tsai <thebroke...@gmail.com>
    unsatisfied_requirement
    satisfied_requirement
    open
    diffy

    bcd a (Gerrit)

    unread,
    Sep 27, 2024, 3:54:41 AM9/27/24
    to Jes Cok, Gerrit Bot, goph...@pubsubhelper.golang.org, Joe Tsai, Go LUCI, Ian Lance Taylor, Russ Cox, Joseph Tsai, Brad Fitzpatrick, Daniel Martí, Gopher Robot, golang-co...@googlegroups.com
    Attention needed from Russ Cox

    bcd a added 1 comment

    Patchset-level comments
    File-level comment, Patchset 1:
    Gopher Robot . resolved

    I spotted some possible problems.

    These findings are based on simple heuristics. If a finding appears wrong, briefly reply here saying so. Otherwise, please address any problems and update the GitHub PR. When complete, mark this comment as 'Done' and click the [blue 'Reply' button](https://go.dev/wiki/GerritBot#i-left-a-reply-to-a-comment-in-gerrit-but-no-one-but-me-can-see-it) above.

    Possible problems detected:
    1. The commit message body is very brief. That can be OK if the change is trivial like correcting spelling or fixing a broken link, but usually the description should provide context for the change and explain what it does in complete sentences.

    The commit title and commit message body come from the GitHub PR title and description, and must be edited in the GitHub web interface (not via git). For instructions, see [here](https://go.dev/wiki/GerritBot/#how-does-gerritbot-determine-the-final-commit-message). For guidelines on commit messages for the Go project, see [here](https://go.dev/doc/contribute#commit_messages).


    (In general for Gerrit code reviews, the change author is expected to [log in to Gerrit](https://go-review.googlesource.com/login/) with a Gmail or other Google account and then close out each piece of feedback by marking it as 'Done' if implemented as suggested or otherwise reply to each review comment. See the [Review](https://go.dev/doc/contribute#review) section of the Contributing Guide for details.)

    bcd a

    Acknowledged

    Gerrit-CC: bcd a <letmetel...@gmail.com>
    Gerrit-Attention: Russ Cox <r...@golang.org>
    Gerrit-Comment-Date: Fri, 27 Sep 2024 07:54:34 +0000
    Gerrit-HasComments: Yes
    Gerrit-Has-Labels: No
    Comment-In-Reply-To: Gopher Robot <go...@golang.org>
    unsatisfied_requirement
    satisfied_requirement
    open
    diffy

    Gerrit Bot (Gerrit)

    unread,
    Sep 27, 2024, 9:26:56 AM9/27/24
    to Jes Cok, goph...@pubsubhelper.golang.org, golang-co...@googlegroups.com
    Attention needed from Ian Lance Taylor, Ian Lance Taylor and Russ Cox

    Gerrit Bot uploaded new patchset

    Gerrit Bot uploaded patch set #5 to this change.
    Following approvals got outdated and were removed:
    • TryBots-Pass: LUCI-TryBot-Result+1 by Go LUCI
    Open in Gerrit

    Related details

    Attention is currently required from:
    • Ian Lance Taylor
    • Ian Lance Taylor
    • Russ Cox
    Submit Requirements:
      • requirement is not satisfiedCode-Review
      • requirement is not satisfiedNo-Unresolved-Comments
      • requirement is not satisfiedReview-Enforcement
      • requirement is not satisfiedTryBots-Pass
      Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
      Gerrit-MessageType: newpatchset
      Gerrit-Project: go
      Gerrit-Branch: master
      Gerrit-Change-Id: Ic13523c0b3acdfc5b3e29a717bc62fde302ed8fd
      Gerrit-Change-Number: 615676
      Gerrit-PatchSet: 5
      Gerrit-Owner: Gerrit Bot <letsus...@gmail.com>
      Gerrit-Reviewer: Ian Lance Taylor <ia...@golang.org>
      Gerrit-Reviewer: Ian Lance Taylor <ia...@google.com>
      Gerrit-Reviewer: Russ Cox <r...@golang.org>
      Gerrit-CC: Brad Fitzpatrick <brad...@golang.org>
      Gerrit-CC: Daniel Martí <mv...@mvdan.cc>
      Gerrit-CC: Gopher Robot <go...@golang.org>
      Gerrit-CC: Jes Cok <xigua...@gmail.com>
      Gerrit-CC: Joe Tsai <thebroke...@gmail.com>
      Gerrit-CC: Joseph Tsai <joe...@digital-static.net>
      Gerrit-CC: bcd a <letmetel...@gmail.com>
      Gerrit-Attention: Ian Lance Taylor <ia...@google.com>
      Gerrit-Attention: Ian Lance Taylor <ia...@golang.org>
      Gerrit-Attention: Russ Cox <r...@golang.org>
      unsatisfied_requirement
      open
      diffy

      Ian Lance Taylor (Gerrit)

      unread,
      Sep 27, 2024, 11:14:28 AM9/27/24
      to Jes Cok, Gerrit Bot, goph...@pubsubhelper.golang.org, Ian Lance Taylor, bcd a, Joe Tsai, Go LUCI, Russ Cox, Joseph Tsai, Brad Fitzpatrick, Daniel Martí, Gopher Robot, golang-co...@googlegroups.com
      Attention needed from Ian Lance Taylor and Russ Cox

      Ian Lance Taylor voted Commit-Queue+1

      Commit-Queue+1
      Open in Gerrit

      Related details

      Attention is currently required from:
      • Ian Lance Taylor
      • Russ Cox
      Submit Requirements:
      • requirement is not satisfiedCode-Review
      • requirement is not satisfiedNo-Unresolved-Comments
      • requirement is not satisfiedReview-Enforcement
      • requirement is not satisfiedTryBots-Pass
      Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
      Gerrit-MessageType: comment
      Gerrit-Project: go
      Gerrit-Branch: master
      Gerrit-Change-Id: Ic13523c0b3acdfc5b3e29a717bc62fde302ed8fd
      Gerrit-Change-Number: 615676
      Gerrit-PatchSet: 5
      Gerrit-Owner: Gerrit Bot <letsus...@gmail.com>
      Gerrit-Reviewer: Ian Lance Taylor <ia...@golang.org>
      Gerrit-Reviewer: Ian Lance Taylor <ia...@google.com>
      Gerrit-Reviewer: Russ Cox <r...@golang.org>
      Gerrit-CC: Brad Fitzpatrick <brad...@golang.org>
      Gerrit-CC: Daniel Martí <mv...@mvdan.cc>
      Gerrit-CC: Gopher Robot <go...@golang.org>
      Gerrit-CC: Jes Cok <xigua...@gmail.com>
      Gerrit-CC: Joe Tsai <thebroke...@gmail.com>
      Gerrit-CC: Joseph Tsai <joe...@digital-static.net>
      Gerrit-CC: bcd a <letmetel...@gmail.com>
      Gerrit-Attention: Ian Lance Taylor <ia...@google.com>
      Gerrit-Attention: Russ Cox <r...@golang.org>
      Gerrit-Comment-Date: Fri, 27 Sep 2024 15:14:20 +0000
      Gerrit-HasComments: No
      Gerrit-Has-Labels: Yes
      unsatisfied_requirement
      open
      diffy

      Gerrit Bot (Gerrit)

      unread,
      Sep 28, 2024, 2:23:40 AM9/28/24
      to Jes Cok, goph...@pubsubhelper.golang.org, golang-co...@googlegroups.com
      Attention needed from Ian Lance Taylor, Ian Lance Taylor and Russ Cox

      Gerrit Bot uploaded new patchset

      Gerrit Bot uploaded patch set #6 to this change.
      Following approvals got outdated and were removed:
      • TryBots-Pass: LUCI-TryBot-Result+1 by Go LUCI
      Open in Gerrit

      Related details

      Attention is currently required from:
      • Ian Lance Taylor
      • Ian Lance Taylor
      • Russ Cox
      Submit Requirements:
      • requirement is not satisfiedCode-Review
      • requirement is not satisfiedNo-Unresolved-Comments
      • requirement is not satisfiedReview-Enforcement
      • requirement is not satisfiedTryBots-Pass
      Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
      Gerrit-MessageType: newpatchset
      Gerrit-Project: go
      Gerrit-Branch: master
      Gerrit-Change-Id: Ic13523c0b3acdfc5b3e29a717bc62fde302ed8fd
      Gerrit-Change-Number: 615676
      Gerrit-PatchSet: 6
      Gerrit-Owner: Gerrit Bot <letsus...@gmail.com>
      Gerrit-Reviewer: Ian Lance Taylor <ia...@golang.org>
      Gerrit-Reviewer: Ian Lance Taylor <ia...@google.com>
      Gerrit-Reviewer: Russ Cox <r...@golang.org>
      Gerrit-CC: Brad Fitzpatrick <brad...@golang.org>
      Gerrit-CC: Daniel Martí <mv...@mvdan.cc>
      Gerrit-CC: Gopher Robot <go...@golang.org>
      Gerrit-CC: Jes Cok <xigua...@gmail.com>
      Gerrit-CC: Joe Tsai <thebroke...@gmail.com>
      Gerrit-CC: Joseph Tsai <joe...@digital-static.net>
      Gerrit-CC: bcd a <letmetel...@gmail.com>
      Gerrit-Attention: Ian Lance Taylor <ia...@google.com>
      unsatisfied_requirement
      open
      diffy

      Ian Lance Taylor (Gerrit)

      unread,
      Sep 28, 2024, 10:25:03 AM9/28/24
      to Jes Cok, Gerrit Bot, goph...@pubsubhelper.golang.org, Ian Lance Taylor, Go LUCI, bcd a, Joe Tsai, Russ Cox, Joseph Tsai, Brad Fitzpatrick, Daniel Martí, Gopher Robot, golang-co...@googlegroups.com
      Attention needed from Ian Lance Taylor and Russ Cox

      Ian Lance Taylor voted Commit-Queue+1

      Commit-Queue+1
      Open in Gerrit

      Related details

      Attention is currently required from:
      • Ian Lance Taylor
      • Russ Cox
      Submit Requirements:
      • requirement is not satisfiedCode-Review
      • requirement is not satisfiedNo-Unresolved-Comments
      • requirement is not satisfiedReview-Enforcement
      • requirement is not satisfiedTryBots-Pass
      Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
      Gerrit-MessageType: comment
      Gerrit-Project: go
      Gerrit-Branch: master
      Gerrit-Change-Id: Ic13523c0b3acdfc5b3e29a717bc62fde302ed8fd
      Gerrit-Change-Number: 615676
      Gerrit-PatchSet: 6
      Gerrit-Owner: Gerrit Bot <letsus...@gmail.com>
      Gerrit-Reviewer: Ian Lance Taylor <ia...@golang.org>
      Gerrit-Reviewer: Ian Lance Taylor <ia...@google.com>
      Gerrit-Reviewer: Russ Cox <r...@golang.org>
      Gerrit-CC: Brad Fitzpatrick <brad...@golang.org>
      Gerrit-CC: Daniel Martí <mv...@mvdan.cc>
      Gerrit-CC: Gopher Robot <go...@golang.org>
      Gerrit-CC: Jes Cok <xigua...@gmail.com>
      Gerrit-CC: Joe Tsai <thebroke...@gmail.com>
      Gerrit-CC: Joseph Tsai <joe...@digital-static.net>
      Gerrit-CC: bcd a <letmetel...@gmail.com>
      Gerrit-Attention: Ian Lance Taylor <ia...@google.com>
      Gerrit-Attention: Russ Cox <r...@golang.org>
      Gerrit-Comment-Date: Sat, 28 Sep 2024 14:24:54 +0000
      Gerrit-HasComments: No
      Gerrit-Has-Labels: Yes
      unsatisfied_requirement
      open
      diffy

      bcd a (Gerrit)

      unread,
      Sep 28, 2024, 9:36:11 PM9/28/24
      to Jes Cok, Gerrit Bot, goph...@pubsubhelper.golang.org, Go LUCI, Ian Lance Taylor, Joe Tsai, Russ Cox, Joseph Tsai, Brad Fitzpatrick, Daniel Martí, Gopher Robot, golang-co...@googlegroups.com
      Attention needed from Ian Lance Taylor, Joe Tsai and Russ Cox

      bcd a added 1 comment

      File src/encoding/json/encode.go
      Line 332, Patchset 4:func isZeroValue(v reflect.Value) bool {

      if z, ok := v.Interface().(interface {
      IsZero() bool
      }); ok {
      return z.IsZero()
      }
      return v.IsZero()
      }
      Joe Tsai . unresolved

      While this is nice, concise, and simple, it unfortunately doesn't handle a few edge cases in particular with nil interfaces, nil pointers, and addressability.

      The exact implementation that the "github.com/go-json-experiment/json" uses is here:
      https://github.com/go-json-experiment/json/blob/ebd3a8989ca1eadb7a68e02a93448ecbbab5900c/fields.go#L167-L184

      It's open to debate whether we should call IsZero on nil pointers, but we decided not to do so to avoid a possible nil pointer panic, which could be fatal in JSON marshaling/unmarshaling. I can't imagine a use-case where an IsZero method reports false on a nil-pointer receiver. However, there exist implementations of IsZero defined on a pointer receiver that also forgot to check whether it is in.

      Also, we should check whether the pointer version of T also implements IsZero. This would be similar to how MarshalJSON and MarshalText defined on (*T) is inconsistently called because they have struct field that is of type T. This is not people expect and a source of many bugs.

      Joe Tsai

      I just did a static analysis of all open-source Go code of all `func (*T) IsZero() bool` methods and unfortunately it seems ~85% of them would panic if called on a nil *T, which is worse than I suspected, so that lends credibility to special-casing *T.

      bcd a

      Looks like the new patchset includes all these edge cases, could you please take a look? Thanks.

      Open in Gerrit

      Related details

      Attention is currently required from:
      • Ian Lance Taylor
      • Joe Tsai
      • Russ Cox
      Submit Requirements:
        • requirement is not satisfiedCode-Review
        • requirement is not satisfiedNo-Unresolved-Comments
        • requirement is not satisfiedReview-Enforcement
        • requirement satisfiedTryBots-Pass
        Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
        Gerrit-MessageType: comment
        Gerrit-Project: go
        Gerrit-Branch: master
        Gerrit-Change-Id: Ic13523c0b3acdfc5b3e29a717bc62fde302ed8fd
        Gerrit-Change-Number: 615676
        Gerrit-PatchSet: 6
        Gerrit-Owner: Gerrit Bot <letsus...@gmail.com>
        Gerrit-Reviewer: Ian Lance Taylor <ia...@golang.org>
        Gerrit-Reviewer: Ian Lance Taylor <ia...@google.com>
        Gerrit-Reviewer: Russ Cox <r...@golang.org>
        Gerrit-CC: Brad Fitzpatrick <brad...@golang.org>
        Gerrit-CC: Daniel Martí <mv...@mvdan.cc>
        Gerrit-CC: Gopher Robot <go...@golang.org>
        Gerrit-CC: Jes Cok <xigua...@gmail.com>
        Gerrit-CC: Joe Tsai <thebroke...@gmail.com>
        Gerrit-CC: Joseph Tsai <joe...@digital-static.net>
        Gerrit-CC: bcd a <letmetel...@gmail.com>
        Gerrit-Attention: Ian Lance Taylor <ia...@google.com>
        Gerrit-Attention: Joe Tsai <thebroke...@gmail.com>
        Gerrit-Attention: Russ Cox <r...@golang.org>
        Gerrit-Comment-Date: Sun, 29 Sep 2024 01:36:00 +0000
        Gerrit-HasComments: Yes
        Gerrit-Has-Labels: No
        Comment-In-Reply-To: Joe Tsai <thebroke...@gmail.com>
        unsatisfied_requirement
        satisfied_requirement
        open
        diffy

        Ali Bayati

        unread,
        Sep 29, 2024, 1:42:04 AM9/29/24
        to change...@go-review.googlesource.com, Jes Cok, Gerrit Bot, goph...@pubsubhelper.golang.org, Go LUCI, Ian Lance Taylor, Joe Tsai, Russ Cox, Joseph Tsai, Brad Fitzpatrick, Daniel Martí, Gopher Robot, golang-co...@googlegroups.com

        💐🙏

        1122

        در تاریخ یکشنبه ۲۹ سپتامبر ۲۰۲۴، ۰۵:۰۶ 'bcd a (Gerrit)' via golang-codereviews <golang-co...@googlegroups.com> نوشت:
        --
        You received this message because you are subscribed to the Google Groups "golang-codereviews" group.
        To unsubscribe from this group and stop receiving emails from it, send an email to golang-coderevi...@googlegroups.com.
        To view this discussion on the web visit https://groups.google.com/d/msgid/golang-codereviews/d2307d2191fad7223037044e50b9823427989992-EmailReviewComments-HTML%40go-review.googlesource.com.
        open
        satisfied_requirement
        unsatisfied_requirement
        open
        diffy
        unsatisfied_requirement
        unsatisfied_requirement

        Joe Tsai (Gerrit)

        unread,
        Sep 29, 2024, 2:56:55 AM9/29/24
        to Jes Cok, Gerrit Bot, goph...@pubsubhelper.golang.org, Go LUCI, Ian Lance Taylor, bcd a, Joe Tsai, Russ Cox, Joseph Tsai, Brad Fitzpatrick, Daniel Martí, Gopher Robot, golang-co...@googlegroups.com
        Attention needed from Ian Lance Taylor and Russ Cox

        Joe Tsai added 6 comments

        File src/encoding/json/encode.go
        Line 338, Patchset 6 (Latest):func isZeroValue(v reflect.Value) bool {
        Joe Tsai . unresolved

        We should move this logic into `typeFields`, which is executed exactly once for each type. Otherwise, we would be wasting runtime cycles checking type properties that can be derived ahead of time.

        Line 359, Patchset 6 (Latest): isZero = func() bool { return v.Addr().Interface().(isZeroer).IsZero() }
        Joe Tsai . unresolved
        There's an additional edge case here, we need to do something like:
        ```
        if !v.CanAddr() {
        // Temporarily box v so we can take the address.
        v2 := reflect.New(v.Type()).Elem()
        v2.Set(v)
        v = v2
        }
        ```
        before we can blindly call `reflect.Value.Addr`.

        The `go-json-experiment` module avoids the problem because it strictly enforces that all `reflect.Value` passed around are addressable at an architectural level. We can't benefit from that architectural invariant here, so we might need to call `reflect.New` if the value is not addressable.

        Line 1111, Patchset 6 (Latest):// Do not remove or change the type signature.
        Joe Tsai . unresolved

        Oh yuck...

        Aren't we technically in violation of this?

        The `structFields` type references the `field` type, so we are indirectly changing the signature.

        File src/encoding/json/encode_test.go
        Line 85, Patchset 6 (Latest): return nps.Int == 0
        Joe Tsai . unresolved

        Perhaps invert this? otherwise we can't tell if this was omitted because this is the zero value of `NoPanicStruct` or whether this method was called.

        Line 111, Patchset 6 (Latest):
        Joe Tsai . unresolved

        Could also test float64 with `-0` (and also a `[2]float64{+0, -0}`), which would be omitted since it is zero according to the Go language spec.

        Line 123, Patchset 6 (Latest):}
        Joe Tsai . unresolved

        Should test a `map[string]OptionalsZero` and we expect `NoPanicStruct3.IsZero` to be called even though `IsZero` is on a pointer receiver.

        Open in Gerrit

        Related details

        Attention is currently required from:
        • Ian Lance Taylor
        • Russ Cox
        Gerrit-Attention: Russ Cox <r...@golang.org>
        Gerrit-Comment-Date: Sun, 29 Sep 2024 06:56:45 +0000
        Gerrit-HasComments: Yes
        Gerrit-Has-Labels: No
        unsatisfied_requirement
        satisfied_requirement
        open
        diffy

        Joe Tsai (Gerrit)

        unread,
        Sep 29, 2024, 3:23:56 AM9/29/24
        to Jes Cok, Gerrit Bot, goph...@pubsubhelper.golang.org, Go LUCI, Ian Lance Taylor, bcd a, Joe Tsai, Russ Cox, Joseph Tsai, Brad Fitzpatrick, Daniel Martí, Gopher Robot, golang-co...@googlegroups.com
        Attention needed from Ian Lance Taylor and Russ Cox

        Joe Tsai added 1 comment

        File src/encoding/json/encode.go
        Line 1096, Patchset 6 (Latest): omitZero bool
        Joe Tsai . unresolved

        We should also store an `isZero func(reflect.Value) bool` value.

        Gerrit-Comment-Date: Sun, 29 Sep 2024 07:23:47 +0000
        Gerrit-HasComments: Yes
        Gerrit-Has-Labels: No
        unsatisfied_requirement
        satisfied_requirement
        open
        diffy

        Gerrit Bot (Gerrit)

        unread,
        Sep 29, 2024, 11:07:03 AM9/29/24
        to Jes Cok, goph...@pubsubhelper.golang.org, golang-co...@googlegroups.com
        Attention needed from Ian Lance Taylor, Ian Lance Taylor and Russ Cox

        Gerrit Bot uploaded new patchset

        Gerrit Bot uploaded patch set #7 to this change.
        Following approvals got outdated and were removed:
        • TryBots-Pass: LUCI-TryBot-Result+1 by Go LUCI

        Related details

        Attention is currently required from:
        • Ian Lance Taylor
        • Ian Lance Taylor
        • Russ Cox
        Submit Requirements:
          • requirement is not satisfiedCode-Review
          • requirement is not satisfiedNo-Unresolved-Comments
          • requirement is not satisfiedReview-Enforcement
          • requirement is not satisfiedTryBots-Pass
          Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
          Gerrit-MessageType: newpatchset
          Gerrit-Project: go
          Gerrit-Branch: master
          Gerrit-Change-Id: Ic13523c0b3acdfc5b3e29a717bc62fde302ed8fd
          Gerrit-Change-Number: 615676
          Gerrit-PatchSet: 7
          Gerrit-Owner: Gerrit Bot <letsus...@gmail.com>
          Gerrit-Reviewer: Ian Lance Taylor <ia...@golang.org>
          Gerrit-Reviewer: Ian Lance Taylor <ia...@google.com>
          Gerrit-Reviewer: Russ Cox <r...@golang.org>
          Gerrit-CC: Brad Fitzpatrick <brad...@golang.org>
          Gerrit-CC: Daniel Martí <mv...@mvdan.cc>
          Gerrit-CC: Gopher Robot <go...@golang.org>
          Gerrit-CC: Jes Cok <xigua...@gmail.com>
          Gerrit-CC: Joe Tsai <thebroke...@gmail.com>
          Gerrit-CC: Joseph Tsai <joe...@digital-static.net>
          Gerrit-CC: bcd a <letmetel...@gmail.com>
          Gerrit-Attention: Ian Lance Taylor <ia...@google.com>
          unsatisfied_requirement
          open
          diffy

          bcd a (Gerrit)

          unread,
          Sep 29, 2024, 9:35:19 PM9/29/24
          to Jes Cok, Gerrit Bot, goph...@pubsubhelper.golang.org, Go LUCI, Ian Lance Taylor, Joe Tsai, Russ Cox, Joseph Tsai, Brad Fitzpatrick, Daniel Martí, Gopher Robot, golang-co...@googlegroups.com
          Attention needed from Ian Lance Taylor, Ian Lance Taylor, Joe Tsai and Russ Cox

          bcd a added 9 comments

          Patchset-level comments
          File-level comment, Patchset 7 (Latest):
          bcd a . resolved

          Thanks for reviewing, it would be great to know your thoughts on the new patchset.

          File src/encoding/json/encode.go
          Line 338, Patchset 6:func isZeroValue(v reflect.Value) bool {
          Joe Tsai . resolved

          We should move this logic into `typeFields`, which is executed exactly once for each type. Otherwise, we would be wasting runtime cycles checking type properties that can be derived ahead of time.

          bcd a

          Done

          Line 332, Patchset 4:func isZeroValue(v reflect.Value) bool {
          if z, ok := v.Interface().(interface {
          IsZero() bool
          }); ok {
          return z.IsZero()
          }
          return v.IsZero()
          }
          Joe Tsai . resolved

          While this is nice, concise, and simple, it unfortunately doesn't handle a few edge cases in particular with nil interfaces, nil pointers, and addressability.

          The exact implementation that the "github.com/go-json-experiment/json" uses is here:
          https://github.com/go-json-experiment/json/blob/ebd3a8989ca1eadb7a68e02a93448ecbbab5900c/fields.go#L167-L184

          It's open to debate whether we should call IsZero on nil pointers, but we decided not to do so to avoid a possible nil pointer panic, which could be fatal in JSON marshaling/unmarshaling. I can't imagine a use-case where an IsZero method reports false on a nil-pointer receiver. However, there exist implementations of IsZero defined on a pointer receiver that also forgot to check whether it is in.

          Also, we should check whether the pointer version of T also implements IsZero. This would be similar to how MarshalJSON and MarshalText defined on (*T) is inconsistently called because they have struct field that is of type T. This is not people expect and a source of many bugs.

          Joe Tsai

          I just did a static analysis of all open-source Go code of all `func (*T) IsZero() bool` methods and unfortunately it seems ~85% of them would panic if called on a nil *T, which is worse than I suspected, so that lends credibility to special-casing *T.

          bcd a

          Looks like the new patchset includes all these edge cases, could you please take a look? Thanks.

          bcd a

          Done

          Line 359, Patchset 6: isZero = func() bool { return v.Addr().Interface().(isZeroer).IsZero() }
          Joe Tsai . resolved
          There's an additional edge case here, we need to do something like:
          ```
          if !v.CanAddr() {
          // Temporarily box v so we can take the address.
          v2 := reflect.New(v.Type()).Elem()
          v2.Set(v)
          v = v2
          }
          ```
          before we can blindly call `reflect.Value.Addr`.

          The `go-json-experiment` module avoids the problem because it strictly enforces that all `reflect.Value` passed around are addressable at an architectural level. We can't benefit from that architectural invariant here, so we might need to call `reflect.New` if the value is not addressable.

          bcd a

          Done

          Line 1096, Patchset 6: omitZero bool
          Joe Tsai . resolved

          We should also store an `isZero func(reflect.Value) bool` value.

          bcd a

          Done

          Line 1111, Patchset 6:// Do not remove or change the type signature.
          Joe Tsai . resolved

          Oh yuck...

          Aren't we technically in violation of this?

          The `structFields` type references the `field` type, so we are indirectly changing the signature.

          bcd a

          Done

          File src/encoding/json/encode_test.go
          Line 85, Patchset 6: return nps.Int == 0
          Joe Tsai . resolved

          Perhaps invert this? otherwise we can't tell if this was omitted because this is the zero value of `NoPanicStruct` or whether this method was called.

          bcd a

          Done

          Line 111, Patchset 6:
          Joe Tsai . resolved

          Could also test float64 with `-0` (and also a `[2]float64{+0, -0}`), which would be omitted since it is zero according to the Go language spec.

          bcd a

          Done

          Line 123, Patchset 6:}
          Joe Tsai . resolved

          Should test a `map[string]OptionalsZero` and we expect `NoPanicStruct3.IsZero` to be called even though `IsZero` is on a pointer receiver.

          bcd a

          Done

          Open in Gerrit

          Related details

          Attention is currently required from:
          • Ian Lance Taylor
          • Ian Lance Taylor
          • Joe Tsai
          • Russ Cox
          Submit Requirements:
            • requirement is not satisfiedCode-Review
            • requirement satisfiedNo-Unresolved-Comments
            • requirement is not satisfiedReview-Enforcement
            • requirement is not satisfiedTryBots-Pass
            Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
            Gerrit-MessageType: comment
            Gerrit-Project: go
            Gerrit-Branch: master
            Gerrit-Change-Id: Ic13523c0b3acdfc5b3e29a717bc62fde302ed8fd
            Gerrit-Change-Number: 615676
            Gerrit-PatchSet: 7
            Gerrit-Owner: Gerrit Bot <letsus...@gmail.com>
            Gerrit-Reviewer: Ian Lance Taylor <ia...@golang.org>
            Gerrit-Reviewer: Ian Lance Taylor <ia...@google.com>
            Gerrit-Reviewer: Russ Cox <r...@golang.org>
            Gerrit-CC: Brad Fitzpatrick <brad...@golang.org>
            Gerrit-CC: Daniel Martí <mv...@mvdan.cc>
            Gerrit-CC: Gopher Robot <go...@golang.org>
            Gerrit-CC: Jes Cok <xigua...@gmail.com>
            Gerrit-CC: Joe Tsai <thebroke...@gmail.com>
            Gerrit-CC: Joseph Tsai <joe...@digital-static.net>
            Gerrit-CC: bcd a <letmetel...@gmail.com>
            Gerrit-Attention: Ian Lance Taylor <ia...@google.com>
            Gerrit-Attention: Ian Lance Taylor <ia...@golang.org>
            Gerrit-Attention: Joe Tsai <thebroke...@gmail.com>
            Gerrit-Attention: Russ Cox <r...@golang.org>
            Gerrit-Comment-Date: Mon, 30 Sep 2024 01:35:11 +0000
            Gerrit-HasComments: Yes
            Gerrit-Has-Labels: No
            Comment-In-Reply-To: bcd a <letmetel...@gmail.com>
            Comment-In-Reply-To: Joe Tsai <thebroke...@gmail.com>
            unsatisfied_requirement
            satisfied_requirement
            open
            diffy

            bcd a (Gerrit)

            unread,
            Sep 30, 2024, 3:19:56 AM9/30/24
            to Jes Cok, Gerrit Bot, goph...@pubsubhelper.golang.org, Go LUCI, Ian Lance Taylor, Joe Tsai, Russ Cox, Joseph Tsai, Brad Fitzpatrick, Daniel Martí, Gopher Robot, golang-co...@googlegroups.com
            Attention needed from Ian Lance Taylor, Ian Lance Taylor, Joe Tsai and Russ Cox

            bcd a added 1 comment

            File src/encoding/json/encode.go
            Line 1209, Patchset 7 (Latest): // Temporarily box v so we can take the address.
            bcd a . unresolved

            To match this, I created this test, will mail later if it's the right approach.
            ```
            type MyInt int

            func (mi *MyInt) IsZero() bool {
            return *mi != 0
            }
            type OptionalsZero struct {
            ...
            Map map[string]OptionalsZero `json:"map,omitzero"`
            Mi MyInt `json:"Mi,omitzero"`
            }
            ...

            o.Map = map[string]OptionalsZero{"foo": {}}
            ```

            Open in Gerrit

            Related details

            Attention is currently required from:
            • Ian Lance Taylor
            • Ian Lance Taylor
            • Joe Tsai
            • Russ Cox
            Submit Requirements:
              • requirement is not satisfiedCode-Review
              • requirement is not satisfiedNo-Unresolved-Comments
              Gerrit-Comment-Date: Mon, 30 Sep 2024 07:19:49 +0000
              Gerrit-HasComments: Yes
              Gerrit-Has-Labels: No
              unsatisfied_requirement
              open
              diffy

              bcd a (Gerrit)

              unread,
              Sep 30, 2024, 3:36:03 AM9/30/24
              to Jes Cok, Gerrit Bot, goph...@pubsubhelper.golang.org, Go LUCI, Ian Lance Taylor, Joe Tsai, Russ Cox, Joseph Tsai, Brad Fitzpatrick, Daniel Martí, Gopher Robot, golang-co...@googlegroups.com
              Attention needed from Ian Lance Taylor, Ian Lance Taylor, Joe Tsai and Russ Cox

              bcd a added 1 comment

              File src/encoding/json/encode.go
              Line 1209, Patchset 7 (Latest): // Temporarily box v so we can take the address.
              bcd a . resolved

              To match this, I created this test, will mail later if it's the right approach.
              ```
              type MyInt int

              func (mi *MyInt) IsZero() bool {
              return *mi != 0
              }
              type OptionalsZero struct {
              ...
              Map map[string]OptionalsZero `json:"map,omitzero"`
              Mi MyInt `json:"Mi,omitzero"`
              }
              ...

              o.Map = map[string]OptionalsZero{"foo": {}}
              ```

              bcd a

              Sorry, forgot`TestOmitZeroMap` covered this.

              Open in Gerrit

              Related details

              Attention is currently required from:
              • Ian Lance Taylor
              • Ian Lance Taylor
              • Joe Tsai
              • Russ Cox
              Submit Requirements:
                • requirement is not satisfiedCode-Review
                • requirement satisfiedNo-Unresolved-Comments
                Gerrit-Comment-Date: Mon, 30 Sep 2024 07:35:55 +0000
                Gerrit-HasComments: Yes
                Gerrit-Has-Labels: No
                Comment-In-Reply-To: bcd a <letmetel...@gmail.com>
                unsatisfied_requirement
                satisfied_requirement
                open
                diffy

                Joe Tsai (Gerrit)

                unread,
                Sep 30, 2024, 5:40:09 PM9/30/24
                to Jes Cok, Gerrit Bot, goph...@pubsubhelper.golang.org, Go LUCI, Ian Lance Taylor, bcd a, Joe Tsai, Russ Cox, Joseph Tsai, Brad Fitzpatrick, Daniel Martí, Gopher Robot, golang-co...@googlegroups.com
                Attention needed from Ian Lance Taylor, Ian Lance Taylor and Russ Cox

                Joe Tsai added 5 comments

                Patchset-level comments
                Joe Tsai . resolved

                Thank you for working on this.

                Code looks good. Just a few more possible test cases.

                File src/encoding/json/encode_test.go
                Line 101, Patchset 7 (Latest): Mo map[string]any `json:",omitzero"`
                Joe Tsai . unresolved

                Should test a `map[string]any` with `omitzero` that is actually zero.

                Line 117, Patchset 7 (Latest): Time time.Time `json:"time,omitzero"`
                Joe Tsai . unresolved

                Should also test with `time.Time{}.Local()`, which is usually not equal to `time.Time{}`.

                Line 122, Patchset 7 (Latest): NoPanicStruct1 isZeroer `json:"nps1,omitzero"` // non-nil interface with non-nil pointer
                Joe Tsai . unresolved

                Should also test non-nil interface with nil pointer.

                Line 123, Patchset 7 (Latest): NoPanicStruct2 *NoPanicStruct `json:"nps2,omitzero"` // nil pointer
                Joe Tsai . unresolved

                Should also test with non-nil pointer.

                Open in Gerrit

                Related details

                Attention is currently required from:
                • Ian Lance Taylor
                • Ian Lance Taylor
                • Russ Cox
                Submit Requirements:
                  • requirement is not satisfiedCode-Review
                  • requirement is not satisfiedNo-Unresolved-Comments
                  • requirement is not satisfiedReview-Enforcement
                  • requirement is not satisfiedTryBots-Pass
                  Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
                  Gerrit-MessageType: comment
                  Gerrit-Project: go
                  Gerrit-Branch: master
                  Gerrit-Change-Id: Ic13523c0b3acdfc5b3e29a717bc62fde302ed8fd
                  Gerrit-Change-Number: 615676
                  Gerrit-PatchSet: 7
                  Gerrit-Owner: Gerrit Bot <letsus...@gmail.com>
                  Gerrit-Reviewer: Ian Lance Taylor <ia...@golang.org>
                  Gerrit-Reviewer: Ian Lance Taylor <ia...@google.com>
                  Gerrit-Reviewer: Russ Cox <r...@golang.org>
                  Gerrit-CC: Brad Fitzpatrick <brad...@golang.org>
                  Gerrit-CC: Daniel Martí <mv...@mvdan.cc>
                  Gerrit-CC: Gopher Robot <go...@golang.org>
                  Gerrit-CC: Jes Cok <xigua...@gmail.com>
                  Gerrit-CC: Joe Tsai <thebroke...@gmail.com>
                  Gerrit-CC: Joseph Tsai <joe...@digital-static.net>
                  Gerrit-CC: bcd a <letmetel...@gmail.com>
                  Gerrit-Attention: Ian Lance Taylor <ia...@google.com>
                  Gerrit-Attention: Ian Lance Taylor <ia...@golang.org>
                  Gerrit-Attention: Russ Cox <r...@golang.org>
                  Gerrit-Comment-Date: Mon, 30 Sep 2024 21:40:05 +0000
                  Gerrit-HasComments: Yes
                  Gerrit-Has-Labels: No
                  unsatisfied_requirement
                  open
                  diffy

                  Joseph Tsai (Gerrit)

                  unread,
                  Sep 30, 2024, 5:40:50 PM9/30/24
                  to Jes Cok, Gerrit Bot, goph...@pubsubhelper.golang.org, Go LUCI, Ian Lance Taylor, bcd a, Joe Tsai, Russ Cox, Brad Fitzpatrick, Daniel Martí, Gopher Robot, golang-co...@googlegroups.com
                  Attention needed from Ian Lance Taylor, Ian Lance Taylor and Russ Cox

                  Joseph Tsai voted Code-Review+2

                  Code-Review+2
                  Open in Gerrit

                  Related details

                  Attention is currently required from:
                  • Ian Lance Taylor
                  • Ian Lance Taylor
                  • Russ Cox
                  Submit Requirements:
                  • requirement satisfiedCode-Review
                  • requirement is not satisfiedNo-Unresolved-Comments
                  • requirement is not satisfiedReview-Enforcement
                  • requirement is not satisfiedTryBots-Pass
                  Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
                  Gerrit-MessageType: comment
                  Gerrit-Project: go
                  Gerrit-Branch: master
                  Gerrit-Change-Id: Ic13523c0b3acdfc5b3e29a717bc62fde302ed8fd
                  Gerrit-Change-Number: 615676
                  Gerrit-PatchSet: 7
                  Gerrit-Owner: Gerrit Bot <letsus...@gmail.com>
                  Gerrit-Reviewer: Ian Lance Taylor <ia...@golang.org>
                  Gerrit-Reviewer: Ian Lance Taylor <ia...@google.com>
                  Gerrit-Reviewer: Joseph Tsai <joe...@digital-static.net>
                  Gerrit-Reviewer: Russ Cox <r...@golang.org>
                  Gerrit-CC: Brad Fitzpatrick <brad...@golang.org>
                  Gerrit-CC: Daniel Martí <mv...@mvdan.cc>
                  Gerrit-CC: Gopher Robot <go...@golang.org>
                  Gerrit-CC: Jes Cok <xigua...@gmail.com>
                  Gerrit-CC: Joe Tsai <thebroke...@gmail.com>
                  Gerrit-CC: bcd a <letmetel...@gmail.com>
                  Gerrit-Attention: Ian Lance Taylor <ia...@google.com>
                  Gerrit-Attention: Ian Lance Taylor <ia...@golang.org>
                  Gerrit-Attention: Russ Cox <r...@golang.org>
                  Gerrit-Comment-Date: Mon, 30 Sep 2024 21:40:45 +0000
                  Gerrit-HasComments: No
                  Gerrit-Has-Labels: Yes
                  satisfied_requirement
                  unsatisfied_requirement
                  open
                  diffy

                  Gerrit Bot (Gerrit)

                  unread,
                  Sep 30, 2024, 11:15:16 PM9/30/24
                  to Jes Cok, goph...@pubsubhelper.golang.org, golang-co...@googlegroups.com
                  Attention needed from Ian Lance Taylor, Ian Lance Taylor, Joseph Tsai and Russ Cox

                  Gerrit Bot uploaded new patchset

                  Gerrit Bot uploaded patch set #8 to this change.
                  Open in Gerrit

                  Related details

                  Attention is currently required from:
                  • Ian Lance Taylor
                  • Ian Lance Taylor
                  • Joseph Tsai
                  • Russ Cox
                  Submit Requirements:
                  • requirement satisfiedCode-Review
                  • requirement is not satisfiedNo-Unresolved-Comments
                  • requirement is not satisfiedReview-Enforcement
                  • requirement is not satisfiedTryBots-Pass
                  Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
                  Gerrit-MessageType: newpatchset
                  Gerrit-Project: go
                  Gerrit-Branch: master
                  Gerrit-Change-Id: Ic13523c0b3acdfc5b3e29a717bc62fde302ed8fd
                  Gerrit-Change-Number: 615676
                  Gerrit-PatchSet: 8
                  Gerrit-Owner: Gerrit Bot <letsus...@gmail.com>
                  Gerrit-Reviewer: Ian Lance Taylor <ia...@golang.org>
                  Gerrit-Reviewer: Ian Lance Taylor <ia...@google.com>
                  Gerrit-Reviewer: Joseph Tsai <joe...@digital-static.net>
                  Gerrit-Reviewer: Russ Cox <r...@golang.org>
                  Gerrit-CC: Brad Fitzpatrick <brad...@golang.org>
                  Gerrit-CC: Daniel Martí <mv...@mvdan.cc>
                  Gerrit-CC: Gopher Robot <go...@golang.org>
                  Gerrit-CC: Jes Cok <xigua...@gmail.com>
                  Gerrit-CC: Joe Tsai <thebroke...@gmail.com>
                  Gerrit-CC: bcd a <letmetel...@gmail.com>
                  Gerrit-Attention: Joseph Tsai <joe...@digital-static.net>
                  satisfied_requirement
                  unsatisfied_requirement
                  open
                  diffy

                  Zxilly Chou (Gerrit)

                  unread,
                  Oct 1, 2024, 6:11:58 AM10/1/24
                  to Jes Cok, Gerrit Bot, goph...@pubsubhelper.golang.org, Joseph Tsai, Go LUCI, Ian Lance Taylor, bcd a, Joe Tsai, Russ Cox, Brad Fitzpatrick, Daniel Martí, Gopher Robot, golang-co...@googlegroups.com
                  Attention needed from Ian Lance Taylor, Ian Lance Taylor, Joseph Tsai and Russ Cox

                  Zxilly Chou added 3 comments

                  File src/encoding/json/encode.go
                  Line 1192, Patchset 8 (Latest): field.isZero = func(v reflect.Value) bool {
                  Zxilly Chou . unresolved

                  Maybe the function passed to isZero could be declared globally in advance to avoid duplicate creation?

                  Line 1200, Patchset 8 (Latest): field.isZero = func(v reflect.Value) bool {
                  Zxilly Chou . unresolved

                  same here

                  Line 1205, Patchset 8 (Latest): field.isZero = func(v reflect.Value) bool {
                  Zxilly Chou . unresolved

                  same here

                  Open in Gerrit

                  Related details

                  Attention is currently required from:
                  • Ian Lance Taylor
                  • Ian Lance Taylor
                  • Joseph Tsai
                  • Russ Cox
                  Submit Requirements:
                  • requirement satisfiedCode-Review
                  • requirement is not satisfiedNo-Unresolved-Comments
                  • requirement is not satisfiedReview-Enforcement
                  • requirement is not satisfiedTryBots-Pass
                  Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
                  Gerrit-MessageType: comment
                  Gerrit-Project: go
                  Gerrit-Branch: master
                  Gerrit-Change-Id: Ic13523c0b3acdfc5b3e29a717bc62fde302ed8fd
                  Gerrit-Change-Number: 615676
                  Gerrit-PatchSet: 8
                  Gerrit-Owner: Gerrit Bot <letsus...@gmail.com>
                  Gerrit-Reviewer: Ian Lance Taylor <ia...@golang.org>
                  Gerrit-Reviewer: Ian Lance Taylor <ia...@google.com>
                  Gerrit-Reviewer: Joseph Tsai <joe...@digital-static.net>
                  Gerrit-Reviewer: Russ Cox <r...@golang.org>
                  Gerrit-CC: Brad Fitzpatrick <brad...@golang.org>
                  Gerrit-CC: Daniel Martí <mv...@mvdan.cc>
                  Gerrit-CC: Gopher Robot <go...@golang.org>
                  Gerrit-CC: Jes Cok <xigua...@gmail.com>
                  Gerrit-CC: Joe Tsai <thebroke...@gmail.com>
                  Gerrit-CC: Zxilly Chou <zxi...@outlook.com>
                  Gerrit-CC: bcd a <letmetel...@gmail.com>
                  Gerrit-Attention: Joseph Tsai <joe...@digital-static.net>
                  Gerrit-Attention: Ian Lance Taylor <ia...@google.com>
                  Gerrit-Attention: Ian Lance Taylor <ia...@golang.org>
                  Gerrit-Attention: Russ Cox <r...@golang.org>
                  Gerrit-Comment-Date: Tue, 01 Oct 2024 10:11:51 +0000
                  Gerrit-HasComments: Yes
                  Gerrit-Has-Labels: No
                  satisfied_requirement
                  unsatisfied_requirement
                  open
                  diffy

                  Joseph Tsai (Gerrit)

                  unread,
                  Oct 1, 2024, 1:29:20 PM10/1/24
                  to Jes Cok, Gerrit Bot, goph...@pubsubhelper.golang.org, Zxilly Chou, Go LUCI, Ian Lance Taylor, bcd a, Joe Tsai, Russ Cox, Brad Fitzpatrick, Daniel Martí, Gopher Robot, golang-co...@googlegroups.com
                  Attention needed from Ian Lance Taylor, Ian Lance Taylor, Russ Cox and Zxilly Chou

                  Joseph Tsai voted and added 1 comment

                  Votes added by Joseph Tsai

                  Code-Review+2

                  1 comment

                  File src/encoding/json/encode.go
                  Line 1192, Patchset 8 (Latest): field.isZero = func(v reflect.Value) bool {
                  Zxilly Chou . unresolved

                  Maybe the function passed to isZero could be declared globally in advance to avoid duplicate creation?

                  Joseph Tsai

                  If the anonymous function has no closed over variables, I'm fairly certain the compiler functionally treats this as no different than a global function. Assuming the compiler does what I think it is doing, it's cleaner to keep this here for a simple function since we can more readily see the condition triggering the function along with the function implementation in the same place.

                  Open in Gerrit

                  Related details

                  Attention is currently required from:
                  • Ian Lance Taylor
                  • Ian Lance Taylor
                  • Russ Cox
                  • Zxilly Chou
                  Gerrit-Attention: Ian Lance Taylor <ia...@google.com>
                  Gerrit-Attention: Zxilly Chou <zxi...@outlook.com>
                  Gerrit-Attention: Ian Lance Taylor <ia...@golang.org>
                  Gerrit-Attention: Russ Cox <r...@golang.org>
                  Gerrit-Comment-Date: Tue, 01 Oct 2024 17:29:13 +0000
                  Gerrit-HasComments: Yes
                  Gerrit-Has-Labels: Yes
                  Comment-In-Reply-To: Zxilly Chou <zxi...@outlook.com>
                  satisfied_requirement
                  unsatisfied_requirement
                  open
                  diffy

                  Jes Cok (Gerrit)

                  unread,
                  Oct 1, 2024, 5:36:16 PM10/1/24
                  to Gerrit Bot, goph...@pubsubhelper.golang.org, Zxilly Chou, Joseph Tsai, Go LUCI, Ian Lance Taylor, bcd a, Joe Tsai, Russ Cox, Brad Fitzpatrick, Daniel Martí, Gopher Robot, golang-co...@googlegroups.com
                  Attention needed from Ian Lance Taylor, Ian Lance Taylor, Joe Tsai, Russ Cox and Zxilly Chou

                  Jes Cok added 4 comments

                  File src/encoding/json/encode_test.go
                  Line 101, Patchset 7: Mo map[string]any `json:",omitzero"`
                  Joe Tsai . resolved

                  Should test a `map[string]any` with `omitzero` that is actually zero.

                  Jes Cok

                  Done

                  Line 117, Patchset 7: Time time.Time `json:"time,omitzero"`
                  Joe Tsai . resolved

                  Should also test with `time.Time{}.Local()`, which is usually not equal to `time.Time{}`.

                  Jes Cok

                  Done

                  Line 122, Patchset 7: NoPanicStruct1 isZeroer `json:"nps1,omitzero"` // non-nil interface with non-nil pointer
                  Joe Tsai . resolved

                  Should also test non-nil interface with nil pointer.

                  Jes Cok

                  Done

                  Line 123, Patchset 7: NoPanicStruct2 *NoPanicStruct `json:"nps2,omitzero"` // nil pointer
                  Joe Tsai . resolved

                  Should also test with non-nil pointer.

                  Jes Cok

                  Done

                  Open in Gerrit

                  Related details

                  Attention is currently required from:
                  • Ian Lance Taylor
                  • Ian Lance Taylor
                  • Joe Tsai
                  • Russ Cox
                  • Zxilly Chou
                  Gerrit-Attention: Joe Tsai <thebroke...@gmail.com>
                  Gerrit-Attention: Russ Cox <r...@golang.org>
                  Gerrit-Comment-Date: Tue, 01 Oct 2024 21:36:09 +0000
                  Gerrit-HasComments: Yes
                  Gerrit-Has-Labels: No
                  Comment-In-Reply-To: Joe Tsai <thebroke...@gmail.com>
                  satisfied_requirement
                  unsatisfied_requirement
                  open
                  diffy

                  Jes Cok (Gerrit)

                  unread,
                  Oct 1, 2024, 5:36:40 PM10/1/24
                  to Gerrit Bot, goph...@pubsubhelper.golang.org, Zxilly Chou, Joseph Tsai, Go LUCI, Ian Lance Taylor, bcd a, Joe Tsai, Russ Cox, Brad Fitzpatrick, Daniel Martí, Gopher Robot, golang-co...@googlegroups.com
                  Attention needed from Ian Lance Taylor, Ian Lance Taylor, Joe Tsai, Russ Cox and Zxilly Chou

                  Jes Cok voted Commit-Queue+1

                  Commit-Queue+1
                  Gerrit-Reviewer: Jes Cok <xigua...@gmail.com>
                  Gerrit-Reviewer: Joseph Tsai <joe...@digital-static.net>
                  Gerrit-Reviewer: Russ Cox <r...@golang.org>
                  Gerrit-CC: Brad Fitzpatrick <brad...@golang.org>
                  Gerrit-CC: Daniel Martí <mv...@mvdan.cc>
                  Gerrit-CC: Gopher Robot <go...@golang.org>
                  Gerrit-CC: Joe Tsai <thebroke...@gmail.com>
                  Gerrit-CC: Zxilly Chou <zxi...@outlook.com>
                  Gerrit-CC: bcd a <letmetel...@gmail.com>
                  Gerrit-Attention: Ian Lance Taylor <ia...@google.com>
                  Gerrit-Attention: Zxilly Chou <zxi...@outlook.com>
                  Gerrit-Attention: Ian Lance Taylor <ia...@golang.org>
                  Gerrit-Attention: Joe Tsai <thebroke...@gmail.com>
                  Gerrit-Attention: Russ Cox <r...@golang.org>
                  Gerrit-Comment-Date: Tue, 01 Oct 2024 21:36:31 +0000
                  Gerrit-HasComments: No
                  Gerrit-Has-Labels: Yes
                  satisfied_requirement
                  unsatisfied_requirement
                  open
                  diffy

                  Joseph Tsai (Gerrit)

                  unread,
                  Oct 1, 2024, 5:40:12 PM10/1/24
                  to Jes Cok, Gerrit Bot, goph...@pubsubhelper.golang.org, Zxilly Chou, Go LUCI, Ian Lance Taylor, bcd a, Joe Tsai, Russ Cox, Brad Fitzpatrick, Daniel Martí, Gopher Robot, golang-co...@googlegroups.com
                  Attention needed from Ian Lance Taylor, Ian Lance Taylor, Joe Tsai, Russ Cox and Zxilly Chou

                  Joseph Tsai added 1 comment

                  Patchset-level comments
                  File-level comment, Patchset 8 (Latest):
                  Joseph Tsai . resolved

                  Thank you.

                  Gerrit-Comment-Date: Tue, 01 Oct 2024 21:40:06 +0000
                  Gerrit-HasComments: Yes
                  Gerrit-Has-Labels: No
                  satisfied_requirement
                  unsatisfied_requirement
                  open
                  diffy

                  Jes Cok (Gerrit)

                  unread,
                  Oct 1, 2024, 6:22:04 PM10/1/24
                  to Gerrit Bot, goph...@pubsubhelper.golang.org, Go LUCI, Zxilly Chou, Joseph Tsai, Ian Lance Taylor, bcd a, Joe Tsai, Russ Cox, Brad Fitzpatrick, Daniel Martí, Gopher Robot, golang-co...@googlegroups.com
                  Attention needed from Ian Lance Taylor, Ian Lance Taylor, Joe Tsai, Russ Cox and Zxilly Chou

                  Jes Cok added 3 comments

                  File src/encoding/json/encode.go
                  Line 1192, Patchset 8 (Latest): field.isZero = func(v reflect.Value) bool {
                  Zxilly Chou . resolved

                  Maybe the function passed to isZero could be declared globally in advance to avoid duplicate creation?

                  Joseph Tsai

                  If the anonymous function has no closed over variables, I'm fairly certain the compiler functionally treats this as no different than a global function. Assuming the compiler does what I think it is doing, it's cleaner to keep this here for a simple function since we can more readily see the condition triggering the function along with the function implementation in the same place.

                  Jes Cok

                  Agree with Joe, let's leave this as is. If it's a performance issue, please provide something like benchmarks, thanks.

                  Line 1200, Patchset 8 (Latest): field.isZero = func(v reflect.Value) bool {
                  Zxilly Chou . resolved

                  same here

                  Jes Cok

                  Acknowledged

                  Line 1205, Patchset 8 (Latest): field.isZero = func(v reflect.Value) bool {
                  Zxilly Chou . resolved

                  same here

                  Jes Cok

                  Acknowledged

                  Open in Gerrit

                  Related details

                  Attention is currently required from:
                  • Ian Lance Taylor
                  • Ian Lance Taylor
                  • Joe Tsai
                  • Russ Cox
                  • Zxilly Chou
                  Submit Requirements:
                  • requirement satisfiedCode-Review
                  • requirement satisfiedNo-Unresolved-Comments
                  • requirement is not satisfiedReview-Enforcement
                  • requirement satisfiedTryBots-Pass
                  Gerrit-Comment-Date: Tue, 01 Oct 2024 22:21:56 +0000
                  Gerrit-HasComments: Yes
                  Gerrit-Has-Labels: No
                  Comment-In-Reply-To: Joseph Tsai <joe...@digital-static.net>
                  Comment-In-Reply-To: Zxilly Chou <zxi...@outlook.com>
                  satisfied_requirement
                  unsatisfied_requirement
                  open
                  diffy

                  Ian Lance Taylor (Gerrit)

                  unread,
                  Oct 1, 2024, 6:38:43 PM10/1/24
                  to Jes Cok, Gerrit Bot, goph...@pubsubhelper.golang.org, Go LUCI, Zxilly Chou, Joseph Tsai, Ian Lance Taylor, bcd a, Joe Tsai, Russ Cox, Brad Fitzpatrick, Daniel Martí, Gopher Robot, golang-co...@googlegroups.com
                  Attention needed from Ian Lance Taylor, Joe Tsai, Russ Cox and Zxilly Chou

                  Ian Lance Taylor voted and added 1 comment

                  Votes added by Ian Lance Taylor

                  Auto-Submit+1
                  Code-Review+1
                  Commit-Queue+1

                  1 comment

                  Patchset-level comments
                  Ian Lance Taylor . resolved

                  Thanks.

                  Open in Gerrit

                  Related details

                  Attention is currently required from:
                  • Ian Lance Taylor
                  Gerrit-Attention: Zxilly Chou <zxi...@outlook.com>
                  Gerrit-Attention: Ian Lance Taylor <ia...@golang.org>
                  Gerrit-Attention: Joe Tsai <thebroke...@gmail.com>
                  Gerrit-Attention: Russ Cox <r...@golang.org>
                  Gerrit-Comment-Date: Tue, 01 Oct 2024 22:38:34 +0000
                  Gerrit-HasComments: Yes
                  Gerrit-Has-Labels: Yes
                  satisfied_requirement
                  unsatisfied_requirement
                  open
                  diffy

                  Michael Knyszek (Gerrit)

                  unread,
                  Oct 2, 2024, 10:21:52 AM10/2/24
                  to Jes Cok, Gerrit Bot, goph...@pubsubhelper.golang.org, Go LUCI, Zxilly Chou, Joseph Tsai, Ian Lance Taylor, bcd a, Joe Tsai, Russ Cox, Brad Fitzpatrick, Daniel Martí, Gopher Robot, golang-co...@googlegroups.com
                  Attention needed from Ian Lance Taylor, Joe Tsai, Russ Cox and Zxilly Chou

                  Michael Knyszek voted Code-Review+1

                  Code-Review+1
                  Open in Gerrit

                  Related details

                  Attention is currently required from:
                  • Ian Lance Taylor
                  • Joe Tsai
                  • Russ Cox
                  • Zxilly Chou
                  Submit Requirements:
                    • requirement satisfiedCode-Review
                    • requirement satisfiedNo-Unresolved-Comments
                    • requirement satisfiedReview-Enforcement
                    • requirement satisfiedTryBots-Pass
                    Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
                    Gerrit-MessageType: comment
                    Gerrit-Project: go
                    Gerrit-Branch: master
                    Gerrit-Change-Id: Ic13523c0b3acdfc5b3e29a717bc62fde302ed8fd
                    Gerrit-Change-Number: 615676
                    Gerrit-PatchSet: 8
                    Gerrit-Owner: Gerrit Bot <letsus...@gmail.com>
                    Gerrit-Reviewer: Ian Lance Taylor <ia...@golang.org>
                    Gerrit-Reviewer: Ian Lance Taylor <ia...@google.com>
                    Gerrit-Reviewer: Jes Cok <xigua...@gmail.com>
                    Gerrit-Reviewer: Joseph Tsai <joe...@digital-static.net>
                    Gerrit-Reviewer: Michael Knyszek <mkny...@google.com>
                    Gerrit-Reviewer: Russ Cox <r...@golang.org>
                    Gerrit-CC: Brad Fitzpatrick <brad...@golang.org>
                    Gerrit-CC: Daniel Martí <mv...@mvdan.cc>
                    Gerrit-CC: Gopher Robot <go...@golang.org>
                    Gerrit-CC: Joe Tsai <thebroke...@gmail.com>
                    Gerrit-CC: Zxilly Chou <zxi...@outlook.com>
                    Gerrit-CC: bcd a <letmetel...@gmail.com>
                    Gerrit-Attention: Zxilly Chou <zxi...@outlook.com>
                    Gerrit-Attention: Ian Lance Taylor <ia...@golang.org>
                    Gerrit-Attention: Joe Tsai <thebroke...@gmail.com>
                    Gerrit-Attention: Russ Cox <r...@golang.org>
                    Gerrit-Comment-Date: Wed, 02 Oct 2024 14:21:47 +0000
                    Gerrit-HasComments: No
                    Gerrit-Has-Labels: Yes
                    satisfied_requirement
                    open
                    diffy

                    Gopher Robot (Gerrit)

                    unread,
                    Oct 2, 2024, 10:22:36 AM10/2/24
                    to Jes Cok, Gerrit Bot, goph...@pubsubhelper.golang.org, golang-...@googlegroups.com, Michael Knyszek, Go LUCI, Zxilly Chou, Joseph Tsai, Ian Lance Taylor, bcd a, Joe Tsai, Russ Cox, Brad Fitzpatrick, Daniel Martí, golang-co...@googlegroups.com

                    Gopher Robot submitted the change

                    Change information

                    Commit message:
                    encoding/json: add omitzero option

                    Fixes #45669
                    Change-Id: Ic13523c0b3acdfc5b3e29a717bc62fde302ed8fd
                    GitHub-Last-Rev: 57030f26b0062fa8eda21b3a73b7665deab88c76
                    GitHub-Pull-Request: golang/go#69622
                    Auto-Submit: Ian Lance Taylor <ia...@google.com>
                    Reviewed-by: Ian Lance Taylor <ia...@google.com>
                    Reviewed-by: Joseph Tsai <joe...@digital-static.net>
                    Reviewed-by: Michael Knyszek <mkny...@google.com>
                    Files:
                    • A doc/next/6-stdlib/99-minor/encoding/json/45669.md
                    • M src/encoding/json/encode.go
                    • M src/encoding/json/encode_test.go
                    Change size: L
                    Delta: 3 files changed, 248 insertions(+), 4 deletions(-)
                    Branch: refs/heads/master
                    Submit Requirements:
                    • requirement satisfiedCode-Review: +2 by Joseph Tsai, +1 by Michael Knyszek, +1 by Ian Lance Taylor
                    • requirement satisfiedTryBots-Pass: LUCI-TryBot-Result+1 by Go LUCI
                    Open in Gerrit
                    Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
                    Gerrit-MessageType: merged
                    Gerrit-Project: go
                    Gerrit-Branch: master
                    Gerrit-Change-Id: Ic13523c0b3acdfc5b3e29a717bc62fde302ed8fd
                    Gerrit-Change-Number: 615676
                    Gerrit-PatchSet: 9
                    Gerrit-Owner: Gerrit Bot <letsus...@gmail.com>
                    Gerrit-Reviewer: Gopher Robot <go...@golang.org>
                    Gerrit-Reviewer: Ian Lance Taylor <ia...@golang.org>
                    Gerrit-Reviewer: Ian Lance Taylor <ia...@google.com>
                    Gerrit-Reviewer: Jes Cok <xigua...@gmail.com>
                    Gerrit-Reviewer: Joseph Tsai <joe...@digital-static.net>
                    Gerrit-Reviewer: Michael Knyszek <mkny...@google.com>
                    Gerrit-Reviewer: Russ Cox <r...@golang.org>
                    Gerrit-CC: Brad Fitzpatrick <brad...@golang.org>
                    Gerrit-CC: Daniel Martí <mv...@mvdan.cc>
                    open
                    diffy
                    satisfied_requirement

                    bcd a (Gerrit)

                    unread,
                    Nov 7, 2024, 6:19:24 AM11/7/24
                    to Jes Cok, Gerrit Bot, Gopher Robot, goph...@pubsubhelper.golang.org, Go LUCI, Zxilly Chou, Joseph Tsai, Ian Lance Taylor, Joe Tsai, Russ Cox, Brad Fitzpatrick, Daniel Martí, golang-co...@googlegroups.com

                    bcd a added 1 comment

                    Patchset-level comments
                    File-level comment, Patchset 9 (Latest):
                    bcd a . resolved

                    #69857 is `xml` version of this option. Any chance to get that through before the freeze?

                    Open in Gerrit

                    Related details

                    Attention set is empty
                    Submit Requirements:
                    • requirement satisfiedCode-Review
                    • requirement satisfiedNo-Unresolved-Comments
                    • requirement satisfiedReview-Enforcement
                    • requirement satisfiedTryBots-Pass
                    Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
                    Gerrit-MessageType: comment
                    Gerrit-Project: go
                    Gerrit-Branch: master
                    Gerrit-Change-Id: Ic13523c0b3acdfc5b3e29a717bc62fde302ed8fd
                    Gerrit-Change-Number: 615676
                    Gerrit-PatchSet: 9
                    Gerrit-Owner: Gerrit Bot <letsus...@gmail.com>
                    Gerrit-Reviewer: Gopher Robot <go...@golang.org>
                    Gerrit-Reviewer: Ian Lance Taylor <ia...@golang.org>
                    Gerrit-Reviewer: Ian Lance Taylor <ia...@google.com>
                    Gerrit-Reviewer: Jes Cok <xigua...@gmail.com>
                    Gerrit-Reviewer: Joseph Tsai <joe...@digital-static.net>
                    Gerrit-Reviewer: Michael Knyszek <mkny...@google.com>
                    Gerrit-Reviewer: Russ Cox <r...@golang.org>
                    Gerrit-CC: Brad Fitzpatrick <brad...@golang.org>
                    Gerrit-CC: Daniel Martí <mv...@mvdan.cc>
                    Gerrit-CC: Joe Tsai <thebroke...@gmail.com>
                    Gerrit-CC: Zxilly Chou <zhouxi...@gmail.com>
                    Gerrit-CC: bcd a <letmetel...@gmail.com>
                    Gerrit-Comment-Date: Thu, 07 Nov 2024 11:19:17 +0000
                    Gerrit-HasComments: Yes
                    Gerrit-Has-Labels: No
                    satisfied_requirement
                    open
                    diffy

                    Ian Lance Taylor (Gerrit)

                    unread,
                    Nov 7, 2024, 2:40:57 PM11/7/24
                    to Jes Cok, Gerrit Bot, Gopher Robot, goph...@pubsubhelper.golang.org, Go LUCI, Zxilly Chou, Joseph Tsai, Ian Lance Taylor, bcd a, Joe Tsai, Russ Cox, Brad Fitzpatrick, Daniel Martí, golang-co...@googlegroups.com

                    Ian Lance Taylor added 1 comment

                    Patchset-level comments
                    bcd a . resolved

                    #69857 is `xml` version of this option. Any chance to get that through before the freeze?

                    Ian Lance Taylor

                    It's on the list for the proposal committee, but it may not make it.

                    Gerrit-Comment-Date: Thu, 07 Nov 2024 19:40:50 +0000
                    Gerrit-HasComments: Yes
                    Gerrit-Has-Labels: No
                    Comment-In-Reply-To: bcd a <letmetel...@gmail.com>
                    satisfied_requirement
                    open
                    diffy
                    Reply all
                    Reply to author
                    Forward
                    0 new messages