From f3bf18117b284b63f4350a5aa61773a30d91a6d5 Mon Sep 17 00:00:00 2001 From: Jonathan Amsterdam Date: Tue, 20 Jun 2023 08:55:49 -0400 Subject: [PATCH] log/slog: fix HandlerOptions.ReplaceAttr doc It said that Attrs with an empty key are ignored. In fact, zero Attrs are ignored. Fixes #60870. Change-Id: I221d3a25b0f0cc9001e06e9cc76bab29292c0741 Reviewed-on: https://go-review.googlesource.com/c/go/+/504535 Run-TryBot: Jonathan Amsterdam Reviewed-by: Alan Donovan TryBot-Result: Gopher Robot --- src/log/slog/handler.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/log/slog/handler.go b/src/log/slog/handler.go index 8cd1e563eb..dc4c2d92bd 100644 --- a/src/log/slog/handler.go +++ b/src/log/slog/handler.go @@ -140,7 +140,7 @@ type HandlerOptions struct { // ReplaceAttr is called to rewrite each non-group attribute before it is logged. // The attribute's value has been resolved (see [Value.Resolve]). - // If ReplaceAttr returns an Attr with Key == "", the attribute is discarded. + // If ReplaceAttr returns a zero Attr, the attribute is discarded. // // The built-in attributes with keys "time", "level", "source", and "msg" // are passed to this function, except that time is omitted -- 2.50.0