Skip to content

[log] Add debug logging to five pkg/linters analyzers - #49707

Merged
pelikhan merged 1 commit into
mainfrom
add-logging-linters-seenmapbool-sortslice-tolowerequalfold-trimleft-concatloop-98d480c47b203fab
Aug 2, 2026
Merged

[log] Add debug logging to five pkg/linters analyzers#49707
pelikhan merged 1 commit into
mainfrom
add-logging-linters-seenmapbool-sortslice-tolowerequalfold-trimleft-concatloop-98d480c47b203fab

Conversation

@github-actions

@github-actions github-actions Bot commented Aug 2, 2026

Copy link
Copy Markdown
Contributor

Overview

Adds namespaced debug logging (via pkg/logger) to five pkg/linters analyzers, improving observability without changing analyzer behavior or public API.

Changes

Each of the following files gains a package-level logger (logger.New("linters:<name>")) and Printf calls at analysis entry and at each diagnostic-reporting site:

  • pkg/linters/seenmapbool/seenmapbool.go — logs package analysis start and each map[string]bool-as-set flag.
  • pkg/linters/sortslice/sortslice.go — logs package analysis start and each sort.Slice/sort.SliceStable flag.
  • pkg/linters/stringsconcatloop/stringsconcatloop.go — logs package analysis start and each string-concatenation-in-loop flag.
  • pkg/linters/tolowerequalfold/tolowerequalfold.go — logs package analysis start and each case-insensitive comparison flag.
  • pkg/linters/trimleftright/trimleftright.go — logs package analysis start and each suspicious strings.TrimLeft/TrimRight flag.

Impact

  • Non-breaking: no changes to analyzer names, diagnostics, or public APIs.
  • Debug output is gated by the DEBUG env var per repo convention (e.g. DEBUG=linters:* or DEBUG=*), so default behavior is unaffected.
  • Enables targeted troubleshooting of these five analyzers during gh aw runs or local go vet/golangci-lint-style invocations.

Generated by PR Description Updater for #49707 · auto · 44.3 AIC · ⌖ 5.43 AIC · ⊞ 6.9K ·

Adds logger.New("linters:<name>") to seenmapbool, sortslice,
tolowerequalfold, trimleftright, and stringsconcatloop, following the
existing convention in sibling analyzers (e.g. mapdeletecheck). Each
file logs analysis entry and each flagged diagnostic to aid debugging
of linter behavior on real codebases.
@github-actions github-actions Bot added automation enhancement New feature or request labels Aug 2, 2026
@github-actions

github-actions Bot commented Aug 2, 2026

Copy link
Copy Markdown
Contributor Author

Hey @github-actions[bot] 👋 — thanks for adding debug logging to the linters! This is a focused and consistent set of changes across five analyzers.

A few items to help finalize this:

  • Tests — while these are side-effect-free logging additions, the PR should include unit tests exercising the log output or at minimum verify the changed files compile and run with the new logger calls. The test plan notes the sandbox could not run make build due to Go version constraints — consider running this locally or in a fresh environment to confirm all changes pass linting and tests.
  • Complete test plan — the test plan checklist is currently unchecked. Please verify or update the CI status once the Go version constraint is resolved.

Once tests are confirmed passing, this PR should be ready for review.

Verify that pkg/linters changes compile and pass unit tests:
1. Ensure all five modified files (seenmapbool, sortslice, stringsconcatloop, tolowerequalfold, trimleftright) build without errors
2. Run the linters package tests to confirm no regressions
3. Spot-check one or two of the new log statements are reachable and execute correctly
Report success/failure of make build and make test commands.

Generated by ✅ Contribution Check · auto · 46.6 AIC · ⌖ 8.19 AIC · ⊞ 8.7K ·

@pelikhan
pelikhan merged commit 00b4272 into main Aug 2, 2026
@pelikhan
pelikhan deleted the add-logging-linters-seenmapbool-sortslice-tolowerequalfold-trimleft-concatloop-98d480c47b203fab branch August 2, 2026 09:54
@github-actions

github-actions Bot commented Aug 3, 2026

Copy link
Copy Markdown
Contributor Author

🎉 This pull request is included in a new release.

Release: v0.84.3

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

automation enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant