Skip to content

Commit 17527c9

Browse files
authored
docs: adapt golangci-lint configuration to v2 (#1318)
1 parent 5585802 commit 17527c9

File tree

1 file changed

+18
-15
lines changed

1 file changed

+18
-15
lines changed

‎README.md‎

Lines changed: 18 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -192,31 +192,34 @@ To enable `revive` in `golangci-lint` you need to add `revive` to the list of en
192192

193193
```yaml
194194
# golangci-lint configuration file
195+
version: "2"
195196
linters:
196197
enable:
197198
- revive
198199
```
199-
Then `revive` can be configured by adding an entry to the `linters-settings` section of the configuration, for example:
200+
201+
Then `revive` can be configured by adding an entry to the `linters.settings` section of the configuration, for example:
200202

201203
```yaml
202204
# golangci-lint configuration file
203-
linters-settings:
204-
revive:
205-
ignore-generated-header: true
206-
severity: warning
207-
rules:
208-
- name: atomic
209-
- name: line-length-limit
210-
severity: error
211-
arguments: [80]
212-
- name: unhandled-error
213-
arguments : ["fmt.Printf", "myFunction"]
205+
linters:
206+
settings:
207+
revive:
208+
severity: warning
209+
rules:
210+
- name: atomic
211+
- name: line-length-limit
212+
severity: error
213+
arguments: [80]
214+
- name: unhandled-error
215+
arguments: ["fmt.Printf", "myFunction"]
214216
```
215217

216-
The above configuration enables three rules of `revive`: _atomic_, _line-length-limit_ and _unhandled-error_ and pass some arguments to the last two.
217-
The [Configuration](#configuration) section of this document provides details on how to configure `revive`. Note that while `revive` configuration is in TOML, that of `golangci-lint` is in YAML.
218+
The above configuration enables three rules of `revive`: _atomic_, _line-length-limit_ and _unhandled-error_ and passes some arguments to the last two.
219+
The [Configuration](#configuration) section of this document provides details on how to configure `revive`. Note that while `revive` configuration is in TOML, that of `golangci-lint` is in YAML or JSON.
220+
See the [golangci-lint website](https://golangci-lint.run/usage/linters/#revive) for more information about configuring `revive`.
218221

219-
Please notice that if no particular configuration is provided, `revive` will behave as `go-lint` does, i.e. all `go-lint` rules are enabled (the [Available Rules table](#available-rules) details what are the `go-lint` rules). When a configuration is provided, only rules in the configuration are enabled.
222+
Please notice that if no particular configuration is provided, `revive` will behave as `golint` does, i.e. all `golint` rules are enabled (the [Available Rules table](#available-rules) details what are the `golint` rules). When a configuration is provided, only rules in the configuration are enabled.
220223

221224
### Command Line Flags
222225

0 commit comments

Comments
 (0)