Skip to content

ci: lint job is root-only — 1291 golangci-lint findings across five unlinted workspace modules #174

Description

@cristim

The lint job in .github/workflows/ci.yml runs golangci-lint and go vet from the repository root. Under go.work that covers the root module only, so the other five workspace modules are unlinted — and they are red.

This is the same defect as LeanerCloud/cloud-commitments-cli#1751 (test jobs root-only), in the same file, one job over. LeanerCloud/cloud-commitments-cli#1751 fixes the test steps; this issue is deliberately kept separate so a lint-debt excavation does not bury a CI-gating fix, and vice versa.

Measured

golangci-lint run at the CI-pinned v2.10.1, per module, counts from golangci's own summary:

module issues
. (root, the only one CI lints) 0
pkg 205
providers/aws 272
providers/azure 592
providers/gcp 222
tests/e2e tool error, see below
total unlinted 1291

tests/e2e exits 5 with context loading failed: no go files to analyze — every file in it is behind //go:build e2e, so it needs --build-tags=e2e to be linted at all. Same root cause as the go test half of LeanerCloud/cloud-commitments-cli#1751.

Not all of it is cosmetic — but less of it is serious than first stated

Correction. An earlier revision of this issue called the 193 bodyclose findings "a resource-leak class on a provider that makes real API calls" and recommended triaging them first. That was wrong, and the correction inverts the recommendation. All 193 are in _test.go files — zero in production code — and they sit on okJSONResponse(...), a helper that hand-builds *http.Response fixtures for a fake HTTP client. There is no network resource behind them. Volume aside, they are the least urgent part of this backlog, not the most.

Split by production versus test code, which is the split that decides urgency:

linter production test
errcheck 18 0
unused 12 6
staticcheck 10 1
errorlint 8 0
gosec 1 0
bodyclose 0 193

So the set actually worth triaging is 49 production findings — errcheck 18 (unchecked errors, spread across all four modules), unused 12, staticcheck 10, errorlint 8 (providers/gcp), gosec 1 (providers/aws). Everything else is godot (502), misspell (201), gocritic (80) and the test-only bodyclose block.

Suggested approach

Mirror the per-module loop already used by govulncheck (ci.yml:312), the gosec SARIF scan (:333), and — once LeanerCloud/cloud-commitments-cli#1751 lands — the test steps. But do not turn the gate on and fix 1291 findings in one PR. Suggested split:

  1. Triage the 49 production findings first (errcheck, unused, staticcheck, errorlint, gosec) — these are the ones that can represent real defects, and the set is small enough to review individually.
  2. Handle the 193 test-only bodyclose findings separately — LeanerCloud/cloud-commitments-cli#1759. Volume, not risk.
  3. Land the cosmetic sweep (godot, misspell, gocritic) separately, ideally with --fix, in its own PR. Note the standing caution that autofix must not rewrite SQL identifiers or test-asserted strings.
  4. Only then add the modules to the lint loop, so the gate goes green on the same commit it goes live.

Reversing that order means either a long-red main or a suppressed gate, and suppressing is not on the table.

Verification

Same shape as LeanerCloud/cloud-commitments-cli#1751: after the loop is added, break a lint rule deliberately in providers/azure and confirm CI goes red. Before the change it will not.

Related

Activity

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

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions