You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I just debugged an issue where one part of the codebase was importing log/slog and an older part of the codebase was importing golang.org/x/exp/slog causing me to get very confused why setting the default logger didn't work.
Neither go vet ./... nor staticcheck ./... gave me a warning so I thought this would be a cool thing to check for.
The text was updated successfully, but these errors were encountered:
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.The text was updated successfully, but these errors were encountered: