Updates README with additional nolint notes (#644)

Fixes #642
This commit is contained in:
Matthew Poer 2019-09-09 13:43:21 -04:00 committed by Isaev Denis
parent f84095a973
commit a02e3f573b
2 changed files with 18 additions and 0 deletions

View File

@ -962,6 +962,15 @@ Also, you can exclude all issues in a file by:
package pkg
```
You may add a comment explaining or justifying why `//nolint` is being used on the same line as the flag itself:
```go
//nolint:gocyclo // This legacy function is complex but the team too busy to simplify it
func someLegacyFunction() *string {
// ...
}
```
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.
Use `//nolint` instead of `// nolint` because machine-readable comments should have no space by Go convention.

View File

@ -472,6 +472,15 @@ Also, you can exclude all issues in a file by:
package pkg
```
You may add a comment explaining or justifying why `//nolint` is being used on the same line as the flag itself:
```go
//nolint:gocyclo // This legacy function is complex but the team too busy to simplify it
func someLegacyFunction() *string {
// ...
}
```
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.
Use `//nolint` instead of `// nolint` because machine-readable comments should have no space by Go convention.