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
+9Lines changed: 9 additions & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -962,6 +962,15 @@ Also, you can exclude all issues in a file by:
962
962
package pkg
963
963
```
964
964
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
+
965
974
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.
966
975
967
976
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
+9Lines changed: 9 additions & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -472,6 +472,15 @@ Also, you can exclude all issues in a file by:
472
472
package pkg
473
473
```
474
474
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
+
funcsomeLegacyFunction() *string {
480
+
// ...
481
+
}
482
+
```
483
+
475
484
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.
476
485
477
486
Use `//nolint` instead of `// nolint` because machine-readable comments should have no space by Go convention.
0 commit comments