Skip to content

docs: Add golangci-lint version support and v2 integration guidance #496

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
36 changes: 33 additions & 3 deletions docs/tools/golangci-lint.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,42 @@ import ProPlanNotice from '@site/src/components/ProPlanNotice.mdx';

[golangci-lint](https://golangci-lint.run/) is a fast Go linters runner.


# golangci-lint

## Files

golangci-lint will run on files with the following extensions:
`golangci-lint` is a fast Go linters runner. It is a code quality tool that aggregates many Go linters into a single tool.

## Supported Versions

CodeRabbit currently supports `golangci-lint` v1.x.

Users attempting to use `golangci-lint` v2.x may encounter warnings or unexpected behavior, as full compatibility with v2.x is not yet guaranteed. We recommend configuring your project to use `golangci-lint` v1.x if you experience issues.

## Configuration

`golangci-lint` supports the following configuration files:

- `.golangci.yml`
- `.golangci.yaml`
- `.golangci.toml`
- `.golangci.json`

CodeRabbit will automatically detect and use these configuration files if present in your repository.

## Integrating v1 alongside v2 (Workaround)

If your project requires `golangci-lint` v2 for local development or CI, but you wish to use CodeRabbit for v1-compatible linting, you can manage this by:

1. **Ensuring a v1-compatible configuration file exists:** Create or maintain a `.golangci.yml` (or other supported format) that is compatible with `golangci-lint` v1.x.
2. **Using a separate script for v2:** For your local development or CI, you might use a wrapper script or a different command to invoke `golangci-lint` v2, ensuring it uses a v2-specific configuration if needed. CodeRabbit will primarily look for the standard configuration files.

Alternatively, you can disable `golangci-lint` in CodeRabbit if v2 is strictly required and you cannot maintain a v1-compatible configuration.

## Features

- `.go`
- `go.mod`
`golangci-lint` can detect many issues such as:

## Configuration

Expand Down