]> Cypherpunks repositories - gostls13.git/commit
log/slog: ensure ReplaceAttr does not see a group
authorJonathan Amsterdam <jba@google.com>
Mon, 25 Sep 2023 13:22:48 +0000 (09:22 -0400)
committerJonathan Amsterdam <jba@google.com>
Mon, 25 Sep 2023 20:53:33 +0000 (20:53 +0000)
commit5e9afab7df87045bd919b120c1b05476e14d8a35
tree810731817eeed56e283056a64f6907847ce368fa
parenta5f1d0263c8a5efc22d54480b5657dbaeb53cfcd
log/slog: ensure ReplaceAttr does not see a group

The ReplaceAttr function should not see groups, only leaf attributes.

Previously, we checked an Value for being a group, then resolved it,
then called ReplaceAttr. We neglected to see if it was a group
after resolving it.

Now we resolve first, then check.

Fixes #62731.

Change-Id: I2fc40758e77c445f82deb2c9de8cae7a3b0e22cf
Reviewed-on: https://go-review.googlesource.com/c/go/+/530478
Reviewed-by: Alan Donovan <adonovan@google.com>
Run-TryBot: Jonathan Amsterdam <jba@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
src/log/slog/handler.go
src/log/slog/handler_test.go