Skip to content

Fix all golangci-lint issues across the codebase#32

Merged
andrew merged 2 commits into
mainfrom
fix-lint-issues
Mar 18, 2026
Merged

Fix all golangci-lint issues across the codebase#32
andrew merged 2 commits into
mainfrom
fix-lint-issues

Conversation

@andrew

@andrew andrew commented Mar 18, 2026

Copy link
Copy Markdown
Contributor

Resolves 77 lint issues reported by golangci-lint run --enable gocritic,gocognit,gocyclo,maintidx,dupl,mnd,unparam,ireturn,goconst,errcheck. Net reduction of ~175 lines through shared helpers and deduplication.

  • dupl: Extract shared ProxyUpstream, ProxyMetadata, ProxyFile on *Proxy to replace duplicate proxy methods across conda, cran, hex, go, maven, debian, rpm handlers. Extract shared test helpers for duplicate test patterns.
  • errcheck: Add error discards for resp.Body.Close() and fmt.Fprint in tests.
  • gocognit: Refactor 6 high-complexity functions (composer, npm, pub, pypi rewriteMetadata and MigrateSchema) by extracting helper methods.
  • goconst: Define constants for repeated strings across 13 files.
  • gocritic: Fix exitAfterDefer in main.go, deprecatedComment in config.go, dupBranchBody in schema.go.
  • mnd: Replace ~30 magic numbers with named constants.
  • unparam: Remove unused ctx parameter from updateCacheDB.

andrew added 2 commits March 18, 2026 09:31
Resolve 77 lint issues reported by golangci-lint with gocritic, gocognit,
gocyclo, maintidx, dupl, mnd, unparam, ireturn, goconst, and errcheck
enabled. Net reduction of ~175 lines through shared helpers and
deduplication.
The Storage.Path field is deprecated but still read for backwards
compatibility with existing configs that haven't migrated to the URL field.
@andrew andrew merged commit 599fe9e into main Mar 18, 2026
5 checks passed
@andrew andrew deleted the fix-lint-issues branch March 26, 2026 09:28
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