Open Foxboron opened 3 months ago
I wonder if it would make sense to mark x/exp/slog as deprecated?
I suspect that would be annoying for everyone that doesn't have a new enough stdlib? Could you avoid false positives?
Yeah, that's a potential issue.
stdlib's log/slog is more or less a drop-in replacement for x/exp/slog, but for example x/exp/maps has some stuff that didn't make it in stdlib, so "replace this package with stdlib" isn't always so straight-forward.
Something, somewhere needs to keep a list of things, whether that's in stasticcheck or "// Deprecated: ..." comments, or somewhere else.
Somewhat related issue: #499 (stylecheck: configurable import blacklist).
I suspect this depends on how you want to solve the check.
You could just check if slog
is occupied by multiple packages in your code base, or you could check if you are using slog.Debug
from two different packages.
I just debugged an issue where one part of the codebase was importing
log/slog
and an older part of the codebase was importinggolang.org/x/exp/slog
causing me to get very confused why setting the default logger didn't work.Neither
go vet ./...
norstaticcheck ./...
gave me a warning so I thought this would be a cool thing to check for.