aboutsummaryrefslogtreecommitdiff
path: root/api
diff options
context:
space:
mode:
authorJonathan Amsterdam <jba@google.com>2023-09-20 15:45:08 -0400
committerJonathan Amsterdam <jba@google.com>2023-10-02 13:57:53 +0000
commitdeb8e29000ebecbd788e0e86e239d52c26707457 (patch)
treefee0ba49432c559c76ebbedaaf506b375916e241 /api
parent3fb1d95149fa280343581a48547c3c3f70dac5fb (diff)
downloadgo-deb8e29000ebecbd788e0e86e239d52c26707457.tar.gz
go-deb8e29000ebecbd788e0e86e239d52c26707457.zip
log/slog: JSONHandler elides empty groups even with replacement
Previously, the built-in handlers assumed a group was empty if and only if it had no attributes. But a ReplaceAttr function that returned an empty Attr could produce an empty group even if the group had attrs prior to replacement. The obvious solution, doing the replacement first and then checking, would require allocating storage to hold the replaced Attrs. Instead, we write to the buffer, and if no attributes were written, we back up to before the group name. Fixes #62512. Change-Id: I140e0901f4b157e36594d8d476f1ab326f8f2c2a Reviewed-on: https://go-review.googlesource.com/c/go/+/529855 Run-TryBot: Jonathan Amsterdam <jba@google.com> Reviewed-by: Alan Donovan <adonovan@google.com> TryBot-Result: Gopher Robot <gobot@golang.org>
Diffstat (limited to 'api')
0 files changed, 0 insertions, 0 deletions