Repository navigation
fix(ci): migrate golangci-lint config to v2 schema and fix count-gated alarm outputs - #1137
Conversation
…d alarm outputs Two CI failures share a root cause of config drifting from the tool/resource shape the rest of the repo already moved to: Lint Code job: CI pins golangci-lint v2.10.1 but .golangci.yml was still written for the v1 schema, so the linter rejected it instantly with "unsupported version of the configuration". Migrate the config to the v2 schema (version "2", linters.settings, exclusions, formatters block) via `golangci-lint migrate`. Default-on linters (errcheck, govet, ineffassign, staticcheck, unused) are now implicit; exportloopref is dropped as it was removed in v2 (obsolete on Go 1.22+). Validate Terraform (aws) job: the migration-failure alarm resources gained `count = var.enable_migration_alarm ? 1 : 0`, but the module outputs still referenced them without an index, so `terraform validate` failed with "Missing resource instance key". Wrap both outputs in `one(...[*]...)` so they resolve to the single instance when enabled and null when disabled. Verified locally: `golangci-lint run` now parses the config and lints (no more schema error); `terraform -chdir=terraform/environments/aws validate` succeeds and `terraform fmt -check -recursive terraform/` is clean.
|
Warning Review limit reached
More reviews will be available in 31 minutes and 10 seconds. Learn how PR review limits work. Your organization has run out of usage credits. Purchase more in the billing tab. ⌛ How to resolve this issue?After more reviews become available, a review can be triggered using the We recommend that you space out your commits to avoid hitting the rate limit. 🚦 How do rate limits work?CodeRabbit enforces hourly rate limits for each developer per organization. Our paid plans include higher PR review limits than trial, open-source, and free plans. In all cases, reviews become available again over time. During sustained high-volume PR review activity, CodeRabbit may temporarily slow when the next review becomes available. Please see our Fair Usage Limits Policy for further information. ℹ️ Review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (2)
✨ Finishing Touches🧪 Generate unit tests (beta)
Comment |
What
Fixes two of the failing
CI - Build & Testjobs at their root cause. Both are config that drifted out of sync with what the rest of the repo already moved to.Lint Code (was failing fast, ~6s)
CI pins
golangci-lintv2.10.1(deliberate, see commit6f6fa3f24"pin tool versions"), but.golangci.ymlwas still written for the v1 schema. The v2 binary rejects it instantly (reproduced locally):Migrated the config to the v2 schema with
golangci-lint migrate(addsversion: "2", moves settings underlinters.settings, adds theexclusions/formattersblocks). Default-on linters (errcheck,govet,ineffassign,staticcheck,unused) are now implicit;exportlooprefis dropped since v2 removed it (obsolete on Go 1.22+). No linter is disabled to mask findings.Validate Terraform (aws) (was failing, ~21s)
PR #1130 added
count = var.enable_migration_alarm ? 1 : 0to the migration-alarm resources, but the module outputs still referenced them without an index, soterraform validatefailed:Wrapped both outputs in
one(<resource>[*].<attr>)so they resolve to the single instance when enabled andnullwhen disabled.Verification (local)
golangci-lint runnow parses the v2 config and lints (no more schema error).terraform -chdir=terraform/environments/aws validate->Success! The configuration is valid.terraform fmt -check -recursive terraform/-> clean.Out of scope / needs follow-up
govulncheckfindings:golang.org/x/net(GO-2026-5026 / GO-2026-4918) inproviders/azure+providers/gcp, andgoogle.golang.org/protobufGO-2024-2611 inproviders/gcp. The fix is dependency bumps (golang.org/x/net-> v0.55.0,protobuf-> v1.33.0+) which require network access to fetch the modules and their go.sum entries (unavailable in the working sandbox). Tracked for a separate PR.continue-on-error: true(non-blocking); already handled by ci: use docker compose v2 (fixes docker-compose command not found) #1135 (docker compose v2) plus the deliberate non-blocking guard for the not-yet-implementedDockerfile.test. No change made.getMigrationsPathredeclared and a*float64literal mismatch ininternal/analytics/postgres_analytics_*_test.go) once the schema parses. Those are separate pre-existing problems (the compile error also fails the Integration Tests job) and need their own cleanup.