Skip to content

golangci-lint does not support multi-module repositories #22935

@kpurdon

Description

@kpurdon

Describe the bug

The golangci-lint plugin fails when a repository contains multiple go.mod files (multiple Go modules). The plugin uses DEFAULT_SINGLE_PARTITION which runs all Go packages through a single golangci-lint invocation without respecting module boundaries. This causes golangci-lint to fail because it cannot resolve imports across separate modules.

Additionally, the default version is 1.64.6 (v1.x), while golangci-lint v2.x has been released with significant improvements and is now the recommended version.

Pants version
2.29.1

OS
Both MacOS and Linux

Additional info

A draft fix has been implemented in PR #22934.

Reproduction steps

  1. Create a repository with two Go modules:
    mod_a/go.mod
    mod_a/main.go
    mod_b/go.mod
    mod_b/main.go
  2. Run pants lint mod_a:: mod_b::
  3. Observe golangci-lint fails due to module resolution issues

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions