You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+37-7Lines changed: 37 additions & 7 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -883,20 +883,50 @@ service:
883
883
False positives are inevitable, but we did our best to reduce their count. For example, we have a default enabled set of [exclude patterns](#command-line-options). If a false positive occurred you have the following choices:
884
884
885
885
1. Exclude issue by text using command-line option `-e` or config option `issues.exclude`. It's helpful when you decided to ignore all issues of this type. Also, you can use `issues.exclude-rules` config option for per-path or per-linter configuration.
886
-
2. Exclude this one issue by using special comment `//nolint[:linter1,linter2,...]` on issued line.
887
-
Comment `//nolint` disables all issues reporting on this line. Comment e.g. `//nolint:govet` disables only govet issues for this line.
888
-
If you would like to completely exclude all issues for some function prepend this comment
889
-
above function:
886
+
2. Exclude this one issue by using special comment `//nolint` (see [the section](#nolint) below).
890
887
3. Exclude issues in path by `run.skip-dirs`, `run.skip-files` or `issues.exclude-rules` config options.
891
888
889
+
Please create [GitHub Issues here](https://github.com/golangci/golangci-lint/issues/new) if you find any false positives. We will add it to the default exclude list if it's common or we will fix underlying linter.
890
+
891
+
### Nolint
892
+
893
+
To exclude issues from all linters use `//nolint`. For example, if it's used inline (not from the beginning of the line) it excludes issues only for this line.
894
+
895
+
```go
896
+
var bad_name int //nolint
897
+
```
898
+
899
+
To exclude issues from specific linters only:
900
+
901
+
```go
902
+
var bad_name int //nolint:golint,unused
903
+
```
904
+
905
+
To exclude issues for the block of code use this directive on the beginning of a line:
Please create [GitHub Issues here](https://github.com/golangci/golangci-lint/issues/new) if you find any false positives. We will add it to the default exclude list if it's common or we will fix underlying linter.
920
+
Also, you can exclude all issues in a file by:
921
+
922
+
```go
923
+
//nolint: unparam
924
+
package pkg
925
+
```
926
+
927
+
You can see more examples of using `//nolint` in [our tests](https://github.com/golangci/golangci-lint/tree/master/pkg/result/processors/testdata) for it.
928
+
929
+
Use `//nolint` instead of `// nolint` because machine-readable comments should have no space by Go convention.
Copy file name to clipboardExpand all lines: README.tmpl.md
+37-7Lines changed: 37 additions & 7 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -430,20 +430,50 @@ than the default and have more strict settings:
430
430
False positives are inevitable, but we did our best to reduce their count. For example, we have a default enabled set of [exclude patterns](#command-line-options). If a false positive occurred you have the following choices:
431
431
432
432
1. Exclude issue by text using command-line option `-e` or config option `issues.exclude`. It's helpful when you decided to ignore all issues of this type. Also, you can use `issues.exclude-rules` config option for per-path or per-linter configuration.
433
-
2. Exclude this one issue by using special comment `//nolint[:linter1,linter2,...]` on issued line.
434
-
Comment `//nolint` disables all issues reporting on this line. Comment e.g. `//nolint:govet` disables only govet issues for this line.
435
-
If you would like to completely exclude all issues for some function prepend this comment
436
-
above function:
433
+
2. Exclude this one issue by using special comment `//nolint` (see [the section](#nolint) below).
437
434
3. Exclude issues in path by `run.skip-dirs`, `run.skip-files` or `issues.exclude-rules` config options.
438
435
436
+
Please create [GitHub Issues here](https://github.com/golangci/golangci-lint/issues/new) if you find any false positives. We will add it to the default exclude list if it's common or we will fix underlying linter.
437
+
438
+
### Nolint
439
+
440
+
To exclude issues from all linters use `//nolint`. For example, if it's used inline (not from the beginning of the line) it excludes issues only for this line.
441
+
442
+
```go
443
+
varbad_nameint//nolint
444
+
```
445
+
446
+
To exclude issues from specific linters only:
447
+
448
+
```go
449
+
varbad_nameint//nolint:golint,unused
450
+
```
451
+
452
+
To exclude issues for the block of code use this directive on the beginning of a line:
Please create [GitHub Issues here](https://github.com/golangci/golangci-lint/issues/new) if you find any false positives. We will add it to the default exclude list if it's common or we will fix underlying linter.
467
+
Also, you can exclude all issues in a file by:
468
+
469
+
```go
470
+
//nolint: unparam
471
+
package pkg
472
+
```
473
+
474
+
You can see more examples of using `//nolint` in [our tests](https://github.com/golangci/golangci-lint/tree/master/pkg/result/processors/testdata) for it.
475
+
476
+
Use `//nolint` instead of `// nolint` because machine-readable comments should have no space by Go convention.
0 commit comments