Skip to content

Fix all golangci-lint issues with extended linters#8

Merged
andrew merged 1 commit intomainfrom
fix/lint-issues
Mar 29, 2026
Merged

Fix all golangci-lint issues with extended linters#8
andrew merged 1 commit intomainfrom
fix/lint-issues

Conversation

@andrew
Copy link
Copy Markdown
Contributor

@andrew andrew commented Mar 18, 2026

Resolves all 15 warnings from golangci-lint when run with gocritic, gocognit, gocyclo, maintidx, dupl, mnd, unparam, ireturn, goconst, and errcheck enabled.

  • Replace wrapper lambdas with direct function references (gocritic unlambda)
  • Use += operator instead of x = x + y (gocritic assignOp)
  • Extract operator string constants to fix goconst
  • Refactor normalizeTokens into a tokenNormalizer struct to reduce cognitive complexity from 62 to under 30 (gocognit) and convert if-else chain to switch (gocritic ifElseChain)
  • Replace magic number with named variable (mnd)
  • Allow Expression interface returns in golangci config (ireturn)
  • Add nolint directive for large table-driven test (maintidx)

Resolves gocritic (unlambda, assignOp, ifElseChain), goconst,
gocognit, mnd, ireturn, and maintidx warnings across the codebase.
@andrew andrew merged commit d303ecd into main Mar 29, 2026
2 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.

1 participant