Skip to content

Commit a02e3f5

Browse files
matthewpoerjirfag
authored andcommitted
Updates README with additional nolint notes (#644)
Fixes #642
1 parent f84095a commit a02e3f5

File tree

2 files changed

+18
-0
lines changed

2 files changed

+18
-0
lines changed

README.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -962,6 +962,15 @@ Also, you can exclude all issues in a file by:
962962
package pkg
963963
```
964964
965+
You may add a comment explaining or justifying why `//nolint` is being used on the same line as the flag itself:
966+
967+
```go
968+
//nolint:gocyclo // This legacy function is complex but the team too busy to simplify it
969+
func someLegacyFunction() *string {
970+
// ...
971+
}
972+
```
973+
965974
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.
966975
967976
Use `//nolint` instead of `// nolint` because machine-readable comments should have no space by Go convention.

README.tmpl.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -472,6 +472,15 @@ Also, you can exclude all issues in a file by:
472472
package pkg
473473
```
474474

475+
You may add a comment explaining or justifying why `//nolint` is being used on the same line as the flag itself:
476+
477+
```go
478+
//nolint:gocyclo // This legacy function is complex but the team too busy to simplify it
479+
func someLegacyFunction() *string {
480+
// ...
481+
}
482+
```
483+
475484
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.
476485

477486
Use `//nolint` instead of `// nolint` because machine-readable comments should have no space by Go convention.

0 commit comments

Comments
 (0)