From a02e3f573bb6984e6acfbbb0174ff6c889178427 Mon Sep 17 00:00:00 2001 From: Matthew Poer Date: Mon, 9 Sep 2019 13:43:21 -0400 Subject: [PATCH] Updates README with additional nolint notes (#644) Fixes #642 --- README.md | 9 +++++++++ README.tmpl.md | 9 +++++++++ 2 files changed, 18 insertions(+) diff --git a/README.md b/README.md index 5e78f360..226ed149 100644 --- a/README.md +++ b/README.md @@ -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. diff --git a/README.tmpl.md b/README.tmpl.md index e5ef4387..46c1fef7 100644 --- a/README.tmpl.md +++ b/README.tmpl.md @@ -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.