Skip to content

CICD: Add golangci-lint-action to PR pipeline#4058

Merged
tlimoncelli merged 12 commits intoStackExchange:mainfrom
cafferata:golangci-lint
Feb 9, 2026
Merged

CICD: Add golangci-lint-action to PR pipeline#4058
tlimoncelli merged 12 commits intoStackExchange:mainfrom
cafferata:golangci-lint

Conversation

@cafferata
Copy link
Copy Markdown
Collaborator

@cafferata cafferata commented Feb 8, 2026

Summary

  • Added golangci-lint-action@v9 as a new PR workflow (.github/workflows/pr_lint.yml).
  • Extended .golangci.yml (v2 format) with additional linters: predeclared, godot, asasalint, asciicheck, bidichk, decorder, and durationcheck.

Closes #3313

Test plan

@cafferata cafferata force-pushed the golangci-lint branch 2 times, most recently from 129a2a2 to cb7e89c Compare February 8, 2026 21:08
Rename function `new` to `newAutoDNSProvider` to avoid shadowing the predeclared identifier.
Remove unused function `cfCommentAndTagsA`.
Use strings.ReplaceAll instead of strings.Replace with -1.
Omit type from variable declaration where it can be inferred.
Remove redundant embedded field names from selectors.
Apply De Morgan's law to simplify boolean expressions.
Convert if/else chains on single variables to switch statements.
Merge conditional assignments into variable declarations.
@cafferata
Copy link
Copy Markdown
Collaborator Author

This PR is ready for review. 🚀

The PR: Lint workflow is now passing successfully. Here's a summary of what's included:

New workflow:

  • .github/workflows/pr_lint.yml — runs golangci-lint-action@v9 on every PR.

Linter configuration (.golangci.yml v2 format):

  • Default (standard) linters enabled.
  • Additional linters: predeclared, godot, asasalint, asciicheck, bidichk, decorder, durationcheck.

Code fixes across the codebase:

  • godot — comments now end with a period.
  • predeclared — renamed new() to newAutoDNSProvider() to avoid shadowing.
  • unused — removed unused function cfCommentAndTagsA.
  • staticcheck QF1001 — applied De Morgan's law.
  • staticcheck QF1003 — converted if/else chains to switch statements.
  • staticcheck QF1004 — replaced strings.Replace(..., -1) with strings.ReplaceAll.
  • staticcheck QF1007 — merged conditional assignments into declarations.
  • staticcheck QF1008 — removed redundant embedded field names from selectors.
  • staticcheck ST1023 — omitted inferable type from variable declaration.

Not included (per issue description):

  • containedctx, bodyclose, copyloopvar, errname, errorlint — these require further investigation and code changes.

@cafferata cafferata requested a review from tlimoncelli February 8, 2026 21:15
@tlimoncelli
Copy link
Copy Markdown
Contributor

Wow! Thanks for all the cleanups and fixes!

@tlimoncelli
Copy link
Copy Markdown
Contributor

All tests pass with my creds: #4059

@tlimoncelli tlimoncelli merged commit 7adecc6 into StackExchange:main Feb 9, 2026
25 checks passed
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.

CICD: Add golangci-lint-action to CI/CD pipeline

2 participants