Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Skip linters early if affected package is not imported #54

Merged
merged 1 commit into from
Jan 14, 2025

Conversation

tklauser
Copy link
Member

Skip the ioreadall, slowg and timeafter linters early if the respective packages they check for (i.e. io, slog/log, golang.org/x/exp/slog and time) is not imported by the package that is currently analyzed. This should reduce linter run time a bit on packages that don't import any of the checked packages.

@tklauser tklauser requested a review from rolinh January 10, 2025 13:55
Copy link
Member

@rolinh rolinh left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hah, that's clever!

Skip the ioreadall, slowg and timeafter linters early if the respective
packages they check for (i.e. io, slog/log, golang.org/x/exp/slog and
time) is not imported by the package that is currently analyzed. This
should reduce linter run time a bit on packages that don't import any of
the checked packages.

Signed-off-by: Tobias Klauser <[email protected]>
@tklauser tklauser force-pushed the pr/tklauser/skip-unaffected-imports branch from 6318c5a to 9a4c98d Compare January 14, 2025 09:54
@tklauser tklauser merged commit 96ae0e8 into main Jan 14, 2025
10 checks passed
@tklauser tklauser deleted the pr/tklauser/skip-unaffected-imports branch January 14, 2025 09:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants