Skip to content

build(deps): move golangci-lint to v2 with a v2 config #5072

Description

@dan-petty

Problem or Motivation

The tools lock pins golangci-lint 1.64.8, the last v1 release (#5065 takes 1.64.6 to 1.64.8). The newest release is 2.15.0. Renovate (#4893) will offer the major, and the review fails with it:

  • v2 removes --out-format (use --output.sarif.path=stdout) and --disable-all (use --default=none).
  • The config needs version: "2", linters.default: none, and linters.settings in place of linters-settings.
  • The adapter (src/devops_cli/security/golangci_lint.py, build_command) passes --out-format sarif and --disable-all. The review config (CONST_REVIEW_SCAN_GOLANGCI_LINT_CONFIG in src/devops_cli/config/constants.py) uses disable-all and linters-settings.
  • golangci-lint 1.64.8 refuses a config with version: "2", so the config and the pin move together.

Research of 2026-11-12 (research-ci, record tool:golangci-lint (v2)).

Proposed Solution & Architectural Design

  • tools.lock and the .devcontainer/Dockerfile tools stage: golangci-lint 2.15.0. Each sha256 below was computed from a download and equals the release asset digest:
    • linux-amd64 golangci-lint-2.15.0-linux-amd64.tar.gz member golangci-lint-2.15.0-linux-amd64/golangci-lint, sha256 9b7fe6a6bf6334b98decf8d86b11415ea7889afdabdd1959fdce23af2a9ebcea
    • linux-arm64 golangci-lint-2.15.0-linux-arm64.tar.gz, sha256 b4d8f17068b35ee6060cc2f69a16fb48740d706fbba81661c318649c114a6998
    • darwin-amd64 golangci-lint-2.15.0-darwin-amd64.tar.gz, sha256 767b899a28285e88ded2823d5dcc4bc5ef681173eb2d80f029a7b17ee4ece3b8
    • darwin-arm64 golangci-lint-2.15.0-darwin-arm64.tar.gz, sha256 d1e409481a8ca846c4bc97e781eb5cb1bd5c23353a0b3977a1cbda1b1b6447d5
    • URL prefix: https://github.com/golangci/golangci-lint/releases/download/v2.15.0/
  • build_command: --output.sarif.path=stdout and --default=none.
  • The review config in the v2 form (golangci-lint migrate writes it).
  • Tests: tests/security/test_golangci_lint_scanner.py, tests/security/test_review_pipeline_go.py, and the recorded run of the review canary if one exists.

Done when the review of a Go tree gives the same SARIF findings with 2.15.0 as with 1.64.8.

Target Subsystem

Security & Vulnerability Scanners

Existing Tool Considered

golangci-lint itself: golangci-lint migrate converts the v1 config. No new code.

Source: #4893

Alternatives check of 2026-11-25: in-use.
The repository already uses this tool.
Tool: golangci/golangci-lint (https://github.com/golangci/golangci-lint), GPL-3.0, last activity 2026-11-24, maintained.
Reason: Searches found golangci-lint 2.15.0 itself, already the repository's Go linter, and its v2 release supplies the replacement flags, SARIF output and a migrate command for the config, so no other tool covers the need.

Covers:

  • v2 flags --output.sarif.path=stdout and --default=none
  • SARIF report written to stdout
  • golangci-lint migrate converts the v1 YAML config
  • YAML config with version 2, linters.default and linters.settings

Lacks:

  • No automated v1-to-v2 findings comparison
  • No recorded Go canary output in the repository
  • v2 binary refuses a v1 config, so pin and config move together
  • Adapter flag edits in build_command stay manual

Proposed design

Problem statement

The review adapter still passes golangci-lint v1 flags (--out-format sarif, --disable-all) at src/devops_cli/security/golangci_lint.py:226 and :234, and CONST_REVIEW_SCAN_GOLANGCI_LINT_CONFIG still holds v1 YAML at src/devops_cli/config/constants.py:691. The golangci-lint 2.15.0 of the devtools image refuses both, so a Go review stops instead of giving findings. This change moves build_command and the review config to v2 and updates the Go scanner tests. No pin moves: tools.lock was deleted by #6555 and the devtools image gives the scanner version. A live Go scan waits on a go toolchain that the image lacks, and #7091 records the v2 canary.

Acceptance criteria

Requirement: Scan command uses v2 flags

GolangciLintScanner.build_command SHALL pass --output.sarif.path=stdout for every scan and --default=none before the --enable of each named linter, and MUST NOT pass --out-format or --disable-all.

Scenario: Default scan command

  • WHEN the test test_golangci_lint_build_command runs GolangciLintScanner.build_command with the default linters
  • THEN the command holds run, --output.sarif.path=stdout, --default=none and one --enable for each of errcheck, govet and staticcheck, and holds no --out-format and no --disable-all.

Requirement: Review config is v2

CONST_REVIEW_SCAN_GOLANGCI_LINT_CONFIG SHALL hold the v2 form of the v1 review config, with version: "2" and linters.default: none, and MUST hold no linters-settings key, no disable-all key and no linters.enable list.

Scenario: Review config keys

  • WHEN a test parses the CONST_REVIEW_SCAN_GOLANGCI_LINT_CONFIG constant as YAML
  • THEN version is the string 2, linters.default is none, linters.settings is a mapping, linters holds no enable key and no disable-all key, and the document holds no linters-settings key.

Requirement: Devtools binary verifies the review config

The golangci-lint 2.15.0 of the devtools image SHALL accept the review config, and golangci-lint config verify MUST exit 0 on it.

Scenario: Config verify on the review config

  • WHEN the live test marked @pytest.mark.live("golangci-lint") writes CONST_REVIEW_SCAN_GOLANGCI_LINT_CONFIG to a temporary .golangci.yml and runs golangci-lint config verify -c <file>
  • THEN the command exits 0 and prints no error.

Requirement: Parse a v2 SARIF document

GolangciLintScanner.parse_output SHALL return the findings of a SARIF 2.1.0 document that golangci-lint 2.15.0 writes.

Scenario: Parse a v2 SARIF document

  • WHEN a test hands parse_output a SARIF 2.1.0 document whose driver version is 2.15.0 and holds one result
  • THEN it returns one Finding for that result, with the result's file, line and message, and no parse error.

Requirement: Go scanner tests cover v2

The Go scanner tests SHALL assert the v2 command and parse a v2 SARIF document, and MUST NOT assert --out-format or --disable-all.

Scenario: Go scanner test suite

  • WHEN uv run pytest tests/security/test_golangci_lint_scanner.py runs
  • THEN the suite passes, and test_golangci_lint_build_command holds --output.sarif.path=stdout and --default=none and holds no --out-format and no --disable-all.

Existing Tool Considered

golangci/golangci-lint (https://github.com/golangci/golangci-lint, maintained), the Go linter the repository already runs. The alternatives check of 2026-11-25 in the issue body gives the verdict in-use, and its block records what the tool lacks. This change uses the tool's v2 flags, golangci-lint migrate and golangci-lint config verify, edits build_command and the review config by hand, and adds no new tool or library code. The gaps that the block records stay with #7091.

Key questions

  • Which v2 flags replace --out-format sarif and --disable-all?: --output.sarif.path=stdout replaces --out-format sarif, and --default=none replaces --disable-all. The v2 release supplies both flags, and parse_output reads the SARIF document from stdout. The reviewer's run of golangci-lint run --output.sarif.path=stdout --default=none on the 2.15.0 binary accepted the flags and stopped only on the missing go binary. (best practice) [sources: src/devops_cli/security/golangci_lint.py:226, src/devops_cli/security/golangci_lint.py:234, https://github.com/golangci/golangci-lint]
    • Chosen: --output.sarif.path=stdout and --default=none. The v2 release supplies both replacements, and parse_output reads the SARIF document from stdout.
    • Rejected: Keep --out-format and --disable-all. golangci-lint 2.x removed both flags, so the scan stops at argument parsing.
    • Rejected: --output.sarif.path=<file>. parse_output reads stdout, so a file path loses the findings.
    • Rejected: Add --output.text.path= to disable a text format. The issue's research record and the reviewer's verified command name only --output.sarif.path=stdout, so the change adds no flag that no source records.
  • How does the review config reach the v2 form?: Run golangci-lint migrate on the v1 config with 2.15.0, then remove the linters.enable list that migrate copies from disable-all and enable, because build_command names the linter set. The result holds version: "2", linters.default: none and linters.settings with govet.enable: [lostcancel]. (best practice) [sources: src/devops_cli/config/constants.py:691, https://github.com/golangci/golangci-lint]
    • Chosen: golangci-lint migrate output, with the linters.enable list removed. The tool writes the v2 key names, and the command line stays the only source of the linter set.
    • Rejected: golangci-lint migrate output as it is. The copied linters.enable list would add errcheck, govet and staticcheck to a scan that names another set.
    • Rejected: A hand-written v2 config. A missed key rename gives a config that the binary refuses or that drops a setting.
    • Rejected: Keep the v1 config and stay on 1.64.8. The devtools image ships 2.15.0, and a v2 binary refuses the v1 config.
  • Does the linter list stay on the command line?: Yes. build_command passes --default=none and one --enable for each linter of its linters argument. The review config holds no linters.enable list. (best practice) [sources: src/devops_cli/security/golangci_lint.py:229, src/devops_cli/security/golangci_lint.py:233]
    • Chosen: --default=none and --enable on the command line. The linter list comes from the call, and the review config adds no linter to it.
    • Rejected: linters.enable in the review config. It fixes one list for every scan and adds linters to a call that names another set.
  • Where is the golangci-lint version set now?: In the devtools image, not in this repository. .devcontainer/Dockerfile and the root Dockerfile build FROM ghcr.io/dan-petty/devtools:1.1.12 pinned by digest, and ADR 0031 records that the project's Dockerfile pins no scanner and that a scanner version changes in the devtools image. The reply of 2026-11-20 reports that image's /usr/local/bin/golangci-lint as 2.15.0. tools.lock no longer exists: refactor(deps): delete install-tools and the tools lock #6555 deleted it and install-tools (CHANGELOG.md:840). [sources: docs/adr/0031-review-scanners-run-in-the-runner-pod.md:29, docs/adr/0031-review-scanners-run-in-the-runner-pod.md:35, CHANGELOG.md:840]
  • How does the change check the v2 scan when the runner image holds no go binary?: The devtools 1.1.12 image holds golangci-lint 2.15.0 but no go binary; the reviewer's check of the image found none. GolangciLintScanner._execute returns ScanOutcome("failed", [], "Binary 'go' not found on PATH") when go is absent. go is in neither RUNNER_TOOLS nor NOT_IN_RUNNER, so a test marked @pytest.mark.live("golangci-lint", "go") fails test_each_binary_of_a_live_marked_test_is_held_or_left_out_with_a_reason. This change checks the command and the SARIF parsing with offline tests, and checks the config with the live golangci-lint config verify of the image. The live Go scan and the v1 comparison go to test(security): record a Go review canary for golangci-lint v2 #7091. (best practice) [sources: src/devops_cli/security/golangci_lint.py:161, src/devops_cli/roadmap/runner_tools.py:168, src/devops_cli/roadmap/runner_tools.py:245, tests/roadmap/test_roadmap_runner_tools.py:158]
    • Chosen: Offline command and SARIF tests and a live golangci-lint config verify. Both run today: the offline tests need no toolchain, and the 2.15.0 binary of the image verifies the config.
    • Rejected: A live scan of a Go fixture. The image holds no go binary, so the scan returns Binary 'go' not found on PATH and writes no SARIF.
    • Rejected: Add go to RUNNER_TOOLS or NOT_IN_RUNNER. RUNNER_TOOLS would name a binary that the image lacks, and NOT_IN_RUNNER still leaves the live Go scan out.
  • Does a pin move with the config?: No pin moves in this repository. tools.lock was deleted by refactor(deps): delete install-tools and the tools lock #6555, and the scanner version comes from the devtools image, which already holds golangci-lint 2.15.0. This change moves the config and the command together. (best practice) [sources: CHANGELOG.md:840, docs/adr/0031-review-scanners-run-in-the-runner-pod.md:35]
    • Chosen: Move the config and the command, and leave the image pin. ADR 0031 puts the scanner version in the devtools image, and that image already holds 2.15.0.
    • Rejected: Move tools.lock and the .devcontainer/Dockerfile tools stage to 2.15.0. The file and the stage no longer exist: refactor(deps): delete install-tools and the tools lock #6555 deleted tools.lock and install-tools, and the Dockerfile copies no golangci-lint binary.
  • Does tools.lock hold a golangci-lint pin that must move with the config?: No. The commit holds no tools.lock and no src/devops_cli/tools_lock/ directory: refactor(deps): delete install-tools and the tools lock #6555 deleted install-tools and the tools lock (CHANGELOG.md:840). The 1.64.8 pin that the issue body names is stale, so no pin moves with the config. [sources: CHANGELOG.md:840]

Fit

Fits in one pull request.

Suspected block

None.

Dependencies

None.

Moved to new items

#7091

Activity

  1. added
    source/agent
    on Nov 12, 2026
  2. added
    type/infra
    scope/deps
    status/new
    value/medium
    effort/medium
    on Nov 12, 2026
  3. dan-petty commented on Nov 12, 2026

    @dan-petty
    OwnerAuthor
  4. added
    priority/p2-medium
    on Nov 12, 2026
  5. devops-cli-service commented on Nov 16, 2026

    @devops-cli-service
    Contributor

    Waiting for the alternatives check to run. The next refine round looks at the item again after the check records a verdict.

  6. devops-cli-service commented on Nov 18, 2026

    @devops-cli-service
    Contributor

    The result in the alternatives block of the issue body changed. Before this check: no check. A person decides what the new result means for the item.

    Searches (7)

    Tools considered:

    Searches run:

    • golangci-lint 2.0 --out-format replaced --output.sarif.path --default=none, results: 5
    • golangci-lint v2 migrate config command, results: 5
    • golangci-lint releases v2 migration guide, results: 5
    • golangci-lint migrate v1 config to v2, results: 5
    • golangci-lint migrate command converts v1 configuration file, results: 5
    • golangci-lint v2 migration guide documentation, results: 5
    • golangci-lint linters settings version 2 config example, results: 5

    Sources:

  7. added
    status/ready
    and removed
    status/new
    on Nov 18, 2026
  8. devops-cli-service commented on Nov 18, 2026

    @devops-cli-service
    Contributor

    Status set to Ready at 4624bc7 (see proposed design in issue body).

  9. 7 remaining items

  10. dan-petty commented on Nov 25, 2026

    @dan-petty
    OwnerAuthor

    Returning #5072 for re-scoping because the live Go module scan requirement cannot run in ghcr.io/dan-petty/devtools:1.1.12 or the runner image:

    • Checked .devcontainer/Dockerfile:10 and container binaries (find /usr /opt /home -maxdepth 4 -type f -name go returned nothing): /usr/local/bin/golangci-lint is 2.15.0, but no go toolchain binary is installed in devtools:1.1.12.
    • Checked src/devops_cli/security/golangci_lint.py:161: GolangciLintScanner._execute checks check_binary(BIN_GO) and returns ScanOutcome("failed", [], "Binary 'go' not found on PATH") whenever go is absent.
    • Verified directly with /usr/local/bin/golangci-lint run --output.sarif.path=stdout --default=none --enable=errcheck --enable=govet --enable=staticcheck: while golangci-lint config verify exits 0 on the migrated v2 YAML config, golangci-lint run exits 3 with exec: "go": executable file not found in $PATH and writes no SARIF document on stdout.
    • Checked src/devops_cli/roadmap/runner_tools.py and tests/roadmap/test_roadmap_runner_tools.py:158: golangci-lint is in RUNNER_TOOLS, while go is in neither RUNNER_TOOLS nor NOT_IN_RUNNER, so marking a test @pytest.mark.live("golangci-lint", "go") fails test_each_binary_of_a_live_marked_test_is_held_or_left_out_with_a_reason.

    Please re-scope the SARIF on stdout acceptance criterion to either rely on offline ToolExecutorFake / parse_output tests (keeping only golangci-lint config verify as the devtools:1.1.12 live check) or add go to devtools / NOT_IN_RUNNER.

  11. added
    status/new
    and removed
    status/ready
    on Nov 25, 2026
  12. added
    status/ready
    and removed
    status/new
    on Nov 25, 2026
  13. devops-cli-service commented on Nov 25, 2026

    @devops-cli-service
    Contributor

    Next step: the stage job writes the plan of the item. See Moved to new items in the section Proposed design of the body.

  14. added
    status/in-progress
    status/in-review
    and removed
    status/ready
    status/in-progress
    on Nov 25, 2026
  15. removed
    status/in-review
    on Nov 25, 2026
  16. devops-cli-service commented on Nov 25, 2026

    @devops-cli-service
    Contributor

    Live since 2026-11-25 17:09 UTC

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    effort/mediumpriority/p2-mediumscope/depssource/agenttype/infravalue/medium

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions