Skip to content

Specify required version number in config #3912

Open
@jamescmartinez

Description

@jamescmartinez

Your feature request related to a problem? Please describe.

As a team grows, it's difficult to ensure that we're all running the same version of golangci-lint. This causes inconsistent linting across the team, which was most recently noticed with the upgrade to 1.53.

Describe the solution you'd like.

By specifying a required version number in the config, golangci-lint can enforce that it matches the required version before running.

In the ideal case, the required version number would also be respected by golangci-lint-action, meaning there wouldn't be a need to manually keep the version number in sync in multiple places (e.g., in .github/workflows/ci.yaml and .golangci-lint.yaml.

Describe alternatives you've considered.

We solved this by enforcing a local version in our Taskfile.yaml and ci.yaml:

./Taskfile.yaml:

  lint:
    preconditions:
      - golangci-lint --version | grep -q 1.53
    cmds:
      - golangci-lint run ./...

./.github/workflows/ci.yaml:

      - uses: golangci/golangci-lint-action@v3
        with:
          version: v1.53

Additional context.

Similar to what I'm thinking of, npm has a solution to this with engines and engine-strict.

Metadata

Metadata

Assignees

No one assigned

    Labels

    area: configRelated to .golangci.yml and/or cli optionsenhancementNew feature or improvementno decisionNo decision to fix or not

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions