ci: override golangci-lint and go-mod-tidy jobs to cover v2 module

Context

The common-ci-tasks golang template provides golangci_lint and go_mod_tidy CI jobs, but they only run against the root Go module. The v2 module (v2/go.mod) is not covered. Additionally, the v2 code on master had pre-existing lint violations that were never caught.

What's in this MR?

CI: extend template jobs to cover v2

Overrides the script section of the template-provided golangci_lint and go_mod_tidy jobs to also run against the v2 module. The template's stage, image, rules, artifacts, extends, and retry configuration are preserved via GitLab CI's merge behavior.

  • golangci_lint: runs the linter on root (with code-climate output), then cd v2 and runs again. Handles both golangci-lint v1 and v2 flag syntax.
  • go_mod_tidy: runs go mod tidy on both modules, then checks git diff --exit-code.

Fix pre-existing v2 lint violations

  • Fix gci import grouping in middleware.go, app_test.go, server_test.go
  • Fix godot comment period in httpclient/client.go
  • Disable contextcheck (shutdown contexts are intentionally new, not inherited)
  • Disable interfacebloat (Router interface mirrors chi's by design)
  • Fix deprecated golangci-lint directives in v2/.golangci.yaml (deadline -> timeout, remove skip-dirs)

Scripts in scripts/

The scripts/golangci-lint.sh and scripts/go-mod-tidy.sh (added in !333 (merged)) remain useful for pre-commit hooks during local development. CI now uses inline overrides instead of these scripts to preserve template behavior (code-climate artifacts, drift detection, retry config).

Note: the build, test, and test-fips jobs already cover v2 via scripts/compile.sh and scripts/test.sh.

Edited by Doug Barrett

Merge request reports

Loading