diff --git a/docs/tools/golangci-lint.md b/docs/tools/golangci-lint.md index ba140553..87cc2106 100644 --- a/docs/tools/golangci-lint.md +++ b/docs/tools/golangci-lint.md @@ -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