Why does .golangci.reference.yml use non-default values, and can this be changed? #6176
-
|
When I need to create a golangci-lint.yaml for my projects, I copy .golangci.reference.yml, delete what I don’t need, and keep only what I do. Anything I remove falls back to the tool’s defaults. The problem comes when I upgrade golangci-lint (and the config). It’s hard to see what actually changed since last time: the diff is huge because I removed a lot in the initial pass. Ideally, I wouldn’t delete anything; I’d leave all options explicitly set to their default values, so future diffs only show real changes. But the values in .golangci.reference.yml are not the defaults—they’re arbitrary/non-default—so that ideal workflow isn’t possible. My questions:
|
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 13 replies
-
|
This file is not a configuration example, but a documentation. The reference should not be used as a basis for configuration. The goal is not to define default values, but to expose all possible options. In most cases, you don't need to configure a linter. We don't want to provide a configuration example because there is no real default configuration: the enable linters and their settings must be specific to each project. |
Beta Was this translation helpful? Give feedback.
This file is not a configuration example, but a documentation.
https://github.com/golangci/golangci-lint/blob/fb3e4b2fb1ea3262448b01753a7125b83933eea2/.golangci.reference.yml#L1C1-L5C77
The reference should not be used as a basis for configuration.
The goal is not to define default values, but to expose all possible options.
In most cases, you don't need to configure a linter.
The settings are only here if you want to change the default values.
We don't want to provide a configuration example because there is no real default configuration: the enable linters and their settings must be specific to each project.