]> Cypherpunks.ru repositories - gostls13.git/commit
testing/slogtest: check for no group with empty record
authorJonathan Amsterdam <jba@google.com>
Fri, 7 Jul 2023 13:55:56 +0000 (09:55 -0400)
committerJonathan Amsterdam <jba@google.com>
Tue, 11 Jul 2023 20:08:28 +0000 (20:08 +0000)
commit3eaee3d5dd55dabf9da571be7a6a4fa05f9dbf29
tree336f7e64004e77011f07ab7f80ab2cd5f219b149
parent167c8b73bf92bdfed147e53b030331ac9260e0f6
testing/slogtest: check for no group with empty record

As #61067 pointed out, slog did not properly handle empty groups.
https://go.dev/cl/508436 dealt with most cases inside slog itself,
but handlers must still do a check on their own. Namely, a handler
must not output a group created by WithGroup unless the Record
has attributes.

This change adds a test to slogtest to check that case.

Fixes #61227.

Change-Id: Ibc065b6e5f6e199a41bce8332ea8c7f9d8373392
Reviewed-on: https://go-review.googlesource.com/c/go/+/508438
Reviewed-by: Alan Donovan <adonovan@google.com>
Run-TryBot: Jonathan Amsterdam <jba@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
src/testing/slogtest/slogtest.go