Skip to content

Add extra linters #1160

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

Merged
merged 6 commits into from
Jul 14, 2025
Merged

Add extra linters #1160

merged 6 commits into from
Jul 14, 2025

Conversation

aphralG
Copy link
Contributor

@aphralG aphralG commented Jul 10, 2025

Proposed changes

Added linters which were added in v2 of golangci-lint
Left nolintlint commented out for now and will be done in a future PR as it will require a lot of changes and this PR is already big enough.

  • decorder - Check declaration order and count of types, constants, variables and functions
  • funcorder - Checks the order of functions, methods, and constructors.
  • intrange - Finds places where for loops could make use of an integer range.
  • loggercheck - Checks key value pairs for common logger libraries (kitlog,klog,logr,slog,zap).
  • perfsprint - Checks that fmt.Sprintf can be replaced with a faster alternative.
  • spancheck - Checks for mistakes with OpenTelemetry/Census spans.
  • usetesting - Reports uses of functions with replacement inside the testing package. (ie. os.MkdirTemp("a", "b") -> t.TempDir())

// Commented out for now
nolintlint - Reports ill-formed or insufficient nolint directives. Also can require a comment as to why it is needed

Checklist

Before creating a PR, run through this checklist and mark each as complete.

  • I have read the CONTRIBUTING document
  • I have run make install-tools and have attached any dependency changes to this pull request
  • If applicable, I have added tests that prove my fix is effective or that my feature works
  • If applicable, I have checked that any relevant tests pass after adding my changes
  • If applicable, I have updated any relevant documentation (README.md)
  • If applicable, I have tested my cross-platform changes on Ubuntu 22, Redhat 8, SUSE 15 and FreeBSD 13

@aphralG aphralG self-assigned this Jul 10, 2025
@aphralG aphralG requested a review from a team as a code owner July 10, 2025 10:30
@github-actions github-actions bot added the chore Pull requests for routine tasks label Jul 10, 2025
@dhurley dhurley added the v3.x Issues and Pull Requests related to the major version v3 label Jul 11, 2025
Base automatically changed from update-go-1.24 to main July 14, 2025 13:19
@aphralG aphralG merged commit a4918b3 into main Jul 14, 2025
41 of 42 checks passed
@aphralG aphralG deleted the add-extra-linters branch July 14, 2025 13:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
chore Pull requests for routine tasks v3.x Issues and Pull Requests related to the major version v3
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants