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

Open
wants to merge 4 commits into
base: update-go-1.24
Choose a base branch
from
Open

Add extra linters #1160

wants to merge 4 commits into from

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
@@ -157,7 +157,6 @@ func CorrelationIDAttr(ctx context.Context) slog.Attr {
slog.DebugContext(
ctx,
"Correlation ID not found in context, generating new correlation ID",
"correlation_id",
Copy link
Collaborator

Choose a reason for hiding this comment

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

Were you meant to remove this?

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.

3 participants