Skip to content

Update exhaustive config for golangci-lint v2.15.0 - #9090

Open
torcolvin wants to merge 3 commits into
errcheck-v2.15from
exhaustive-v0.15-config
Open

torcolvin wants to merge 3 commits into
errcheck-v2.15from
exhaustive-v0.15-config

Conversation

@torcolvin

Copy link
Copy Markdown
Collaborator

golangci-lint v2.15.0 ships exhaustive v0.15.0, which changes its configuration keys. On v2.15.0, golangci-lint config verify rejects the current exhaustive keys in .golangci-strict.yml. This PR moves the config to the new keys and fixes the new findings.

Config changes

  • check: map is now check: mapliteral.
  • ignore-enum-members (one regex) is now ignore-constants (a list). indexTypeCount joins auditdSyncGatewayEndID and levelCount as an end-of-enum marker.
  • explicit-exhaustive-map is removed. v0.15 has one explicit-exhaustive flag for switches and map literals together. It cannot check maps only with //exhaustive:enforce while it checks all switches. Map literals are now checked everywhere, and a map that is sparse on purpose opts out.
  • The test-file exclusion now matches the new message text (missing cases in expression switch) and also covers map literals.
  • CI and pre-commit move from v2.14.0 to v2.15.0, because v2.14.0 rejects the new keys.

Code changes for the map-literal findings

  • base/audit_events.go: removed //exhaustive:enforce from AuditEvents. All map literals are checked now, so the directive is not needed. It also gave false warnings on the nested AuditFields maps.
  • db/changes.go: added newRevTreeChange and newCVChange. A ChangeByVersionType holds one version type by design, and the constructors build it with make, so no literal gets checked.
  • db/indexes.go: indexFilterExpressions, readinessQueries and partitionableIndexes now list every index type, with empty or false values in a commented section. GetSGIndexes checks readinessQuery != "" and not presence in the map, so only the three critical indexes stay marked as required.
  • auth/jwt.go: SupportedAlgorithms keeps //exhaustive:ignore. It is an allowlist keyed by a go-jose enum. With explicit false entries, each new go-jose algorithm breaks lint. Also, rest/config.go treats any present key as supported.
  • rest/server_context.go: an empty map[serverType]*serverInfo{} literal is now make(...).

Known CI failure

v2.15.0 also adds 18 errcheck findings, each a bare <-doneChan receive on a chan error in base/ and db/. A separate PR fixes them, and that PR must merge first. Until then, the golangci job on this PR fails on errcheck only.

Testing

  • golangci-lint v2.15.0 with CE and EE build tags: no exhaustive findings.
  • To make sure that the new config still checks map literals, I deleted one AuditEvents entry and one indexNames entry. Lint reported each missing key.
  • The db and rest changes-feed tests and the auth/rest OIDC and JWT tests pass on CE and EE.

Pre-review checklist

  • Logging sensitive data? Make sure it's tagged (e.g. base.UD(docID), base.MD(dbName))
  • Updated relevant information in the API specifications (such as endpoint descriptions, schemas, ...) in docs/api

Dependencies (if applicable)

  • Link upstream PRs
  • Update Go module dependencies when merged

Integration Tests

🤖 Generated with Claude Code

torcolvin and others added 2 commits November 6, 2026 11:05
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
golangci-lint v2.15.0 ships exhaustive v0.15.0, which renames its options
and replaces the per-kind explicit flags with one explicit-exhaustive flag.
Map literals are now checked everywhere, and maps that are sparse on purpose
opt out with //exhaustive:ignore or list every key explicitly.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@torcolvin
torcolvin force-pushed the exhaustive-v0.15-config branch from 68c4f4a to 8c35087 Compare November 7, 2026 00:57
@torcolvin
torcolvin changed the base branch from main to errcheck-v2.15 November 7, 2026 00:58
@torcolvin
torcolvin added this pull request to stack #9093 November 7, 2026 00:59
@torcolvin
torcolvin marked this pull request as ready for review November 7, 2026 00:59
@torcolvin
torcolvin requested review from a team and a balanced review from Copilot November 7, 2026 00:59
@factory-droid

factory-droid Bot commented Nov 7, 2026 •

Copy link
Copy Markdown
Contributor

Droid finished @torcolvin's task —— View job


LGTM — no high-confidence, actionable issues found in the diff.

0 inline comments posted

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🟢 Approval recommended

No active review issues are identified for the golangci-lint migration.

No open issues 🎉

What changed in this PR

Updates Sync Gateway’s lint configuration and tooling to golangci-lint v2.15.0, adapting enum-keyed maps to the new exhaustive checks.

Changes:

  • Migrates exhaustive configuration keys and test exclusions in both lint configurations.
  • Updates CI and pre-commit to v2.15.0.
  • Adjusts map initialization and exemptions, completes index maps, and removes index-readiness metadata.

The PR description notes that CI depends on a separate fix for new errcheck findings.

File Description
rest/​server_context.go Initializes the server map with make.
db/​indexes.go Completes index maps and removes readiness queries and fields.
db/​changes.go Adds constructors for single-version change maps.
base/​audit_events.go Removes the redundant exhaustive enforcement directive.
auth/​jwt.go Exempts the supported-algorithm allowlist from exhaustive checks.
.pre-commit-config.yaml Updates golangci-lint to v2.15.0.
.golangci.yml Migrates exhaustive settings and test exclusions.
.golangci-strict.yml Applies the same migration to strict lint settings.
.github/​workflows/​ci.yml Updates the CI linter to v2.15.0.

Review effort: Balanced

This branch has not been deployed

No deployments
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.

3 participants