[go] encoding/json/v2: remove recursion and error on `string` on unsupported type

2 views
Skip to first unread message

Michael Pratt (Gerrit)

unread,
May 18, 2026, 3:22:35 PM (17 hours ago) May 18
to Michael Pratt, goph...@pubsubhelper.golang.org, Joseph Tsai, Damien Neil, Daniel Martí, Johan Brandhorst-Satzkorn, golang...@luci-project-accounts.iam.gserviceaccount.com, golang-co...@googlegroups.com
Attention needed from Damien Neil, Daniel Martí, Johan Brandhorst-Satzkorn and Joseph Tsai

Michael Pratt added 1 comment

File src/encoding/json/v2/arshal_default.go
Line 1089, Patchset 1 (Latest): for i := range fields.flattened {
Michael Pratt . unresolved

I intend to run benchmarks to see if this extra loop over all fields makes a difference [1].

If so, init can set a hint if any field has string set (which should be rare), and otherwise skip this loop.

[1] We need to do this first rather than inline where the later check occurs below in order to keep the semantic behavior as similar to other errInit errors, which include other struct tag errors. Otherwise, e.g., we will start writing marshal output before returning this error.

Open in Gerrit

Related details

Attention is currently required from:
  • Damien Neil
  • Daniel Martí
  • Johan Brandhorst-Satzkorn
  • Joseph Tsai
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: If970138d65e4164619358009b2d41df06a6a6964
Gerrit-Change-Number: 779300
Gerrit-PatchSet: 1
Gerrit-Owner: Michael Pratt <mpr...@google.com>
Gerrit-Reviewer: Damien Neil <dn...@google.com>
Gerrit-Reviewer: Daniel Martí <mv...@mvdan.cc>
Gerrit-Reviewer: Johan Brandhorst-Satzkorn <johan.br...@gmail.com>
Gerrit-Reviewer: Joseph Tsai <joe...@digital-static.net>
Gerrit-Reviewer: Michael Pratt <mpr...@google.com>
Gerrit-Attention: Damien Neil <dn...@google.com>
Gerrit-Attention: Johan Brandhorst-Satzkorn <johan.br...@gmail.com>
Gerrit-Attention: Daniel Martí <mv...@mvdan.cc>
Gerrit-Attention: Joseph Tsai <joe...@digital-static.net>
Gerrit-Comment-Date: Mon, 18 May 2026 19:22:32 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
unsatisfied_requirement
open
diffy

Damien Neil (Gerrit)

unread,
May 18, 2026, 3:49:42 PM (16 hours ago) May 18
to Michael Pratt, goph...@pubsubhelper.golang.org, golang...@luci-project-accounts.iam.gserviceaccount.com, Joseph Tsai, Daniel Martí, Johan Brandhorst-Satzkorn, golang-co...@googlegroups.com
Attention needed from Daniel Martí, Johan Brandhorst-Satzkorn, Joseph Tsai and Michael Pratt

Damien Neil voted Code-Review+2

Code-Review+2
Open in Gerrit

Related details

Attention is currently required from:
  • Daniel Martí
  • Johan Brandhorst-Satzkorn
  • Joseph Tsai
  • Michael Pratt
Submit Requirements:
  • requirement satisfiedCode-Review
  • requirement is not 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: If970138d65e4164619358009b2d41df06a6a6964
Gerrit-Change-Number: 779300
Gerrit-PatchSet: 1
Gerrit-Owner: Michael Pratt <mpr...@google.com>
Gerrit-Reviewer: Damien Neil <dn...@google.com>
Gerrit-Reviewer: Daniel Martí <mv...@mvdan.cc>
Gerrit-Reviewer: Johan Brandhorst-Satzkorn <johan.br...@gmail.com>
Gerrit-Reviewer: Joseph Tsai <joe...@digital-static.net>
Gerrit-Reviewer: Michael Pratt <mpr...@google.com>
Gerrit-Attention: Johan Brandhorst-Satzkorn <johan.br...@gmail.com>
Gerrit-Attention: Daniel Martí <mv...@mvdan.cc>
Gerrit-Attention: Joseph Tsai <joe...@digital-static.net>
Gerrit-Comment-Date: Mon, 18 May 2026 19:49:38 +0000
Gerrit-HasComments: No
Gerrit-Has-Labels: Yes
satisfied_requirement
unsatisfied_requirement
open
diffy

Joseph Tsai (Gerrit)

unread,
5:05 AM (3 hours ago) 5:05 AM
to Michael Pratt, goph...@pubsubhelper.golang.org, Damien Neil, golang...@luci-project-accounts.iam.gserviceaccount.com, Daniel Martí, Johan Brandhorst-Satzkorn, golang-co...@googlegroups.com
Attention needed from Daniel Martí, Johan Brandhorst-Satzkorn and Michael Pratt

Joseph Tsai voted and added 1 comment

Votes added by Joseph Tsai

Code-Review+2

1 comment

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

Thanks! I'd like to see benchmark data, though.

Open in Gerrit

Related details

Attention is currently required from:
  • Daniel Martí
  • Johan Brandhorst-Satzkorn
  • Michael Pratt
Submit Requirements:
  • requirement satisfiedCode-Review
  • requirement is not 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: If970138d65e4164619358009b2d41df06a6a6964
Gerrit-Change-Number: 779300
Gerrit-PatchSet: 1
Gerrit-Owner: Michael Pratt <mpr...@google.com>
Gerrit-Reviewer: Damien Neil <dn...@google.com>
Gerrit-Reviewer: Daniel Martí <mv...@mvdan.cc>
Gerrit-Reviewer: Johan Brandhorst-Satzkorn <johan.br...@gmail.com>
Gerrit-Reviewer: Joseph Tsai <joe...@digital-static.net>
Gerrit-Reviewer: Michael Pratt <mpr...@google.com>
Gerrit-Attention: Michael Pratt <mpr...@google.com>
Gerrit-Attention: Johan Brandhorst-Satzkorn <johan.br...@gmail.com>
Gerrit-Attention: Daniel Martí <mv...@mvdan.cc>
Gerrit-Comment-Date: Tue, 19 May 2026 09:05:30 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: Yes
satisfied_requirement
unsatisfied_requirement
open
diffy
Reply all
Reply to author
Forward
0 new messages