Skip to content

Commit 005fa64

Browse files
committed
go/analysis/passes/slog: add check for slog.Group
slog.Group now takes a ...any, so add it to the list of functions to check. Change-Id: I73025158a6cf55c7a6689a36f3c2c58df6d0db3f Reviewed-on: https://go-review.googlesource.com/c/tools/+/494098 Run-TryBot: Jonathan Amsterdam <[email protected]> gopls-CI: kokoro <[email protected]> Reviewed-by: Tim King <[email protected]> TryBot-Result: Gopher Robot <[email protected]>
1 parent 033e628 commit 005fa64

File tree

2 files changed

+5
-4
lines changed

2 files changed

+5
-4
lines changed

go/analysis/passes/slog/slog.go

+3-4
Original file line numberDiff line numberDiff line change
@@ -174,10 +174,9 @@ func kvFuncSkipArgs(fn *types.Func) (int, bool) {
174174
}
175175
recv := fn.Type().(*types.Signature).Recv()
176176
if recv == nil {
177-
// TODO: If #59204 is accepted, uncomment the lines below.
178-
// if fn.Name() == "Group" {
179-
// return 0, true
180-
// }
177+
if fn.Name() == "Group" {
178+
return 0, true
179+
}
181180
skip, ok := slogOutputFuncs[fn.Name()]
182181
return skip, ok
183182
}

go/analysis/passes/slog/testdata/src/a/a.go

+2
Original file line numberDiff line numberDiff line change
@@ -143,6 +143,8 @@ func All() {
143143

144144
r.Add(1, 2) // want `slog.Record.Add arg "1" should be a string or a slog.Attr`
145145

146+
_ = slog.Group("a", 1, 2, 3) // want `slog.Group arg "2" should be a string or a slog.Attr`
147+
146148
}
147149

148150
// Used in tests by package b.

0 commit comments

Comments
 (0)