x/tools/go/analysis/passes/slog: False negitive when error
type used as key.
#65740
Labels
NeedsInvestigation
Someone must examine and confirm this is a valid issue and not a duplicate of an existing one.
Tools
This label describes issues relating to any tools in the x/tools repository.
Milestone
Go version
go version go1.22.0 linux/amd64
Output of
go env
in your module/workspace:What did you do?
I wrote code that assumed
slog
methods worked likefmt.Printf
, instead of talkingAttr
/key-value pairs:playground
Running
go vet -slog ./main.go
What did you see happen?
go vet -slog
reports no errors, but the key isn't present.What did you expect to see?
go vet -slog ./main.go
should report an error like./main.go:7:32: slog.Error arg "x" should be a string or a slog.Attr (possible missing key or value)
.Interestingly, if you change the type of
x
toint
, the error fires as you'd expect.The text was updated successfully, but these errors were encountered: