From 463cffdedec5a9c3f7be881468b70951bee389a8 Mon Sep 17 00:00:00 2001 From: Ben Kraft Date: Wed, 15 Sep 2021 17:57:52 -0700 Subject: [PATCH] Lint against fmt.Println except in main.go (#98) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ## Summary: Usually this is an artifact of debugging, not intentional! And it's come up a few times, luckily all noticed by reviewers. ## Test plan: make check Author: benjaminjkraft Reviewers: dnerdy, jvoll Required Reviewers: Approved By: dnerdy Checks: ✅ Test (1.17), ✅ Test (1.16), ✅ Test (1.15), ✅ Test (1.14), ✅ Lint, ✅ Test (1.17), ✅ Test (1.16), ✅ Test (1.15), ✅ Test (1.14), ✅ Lint Pull Request URL: https://github.com/Khan/genqlient/pull/98 --- .golangci.yml | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/.golangci.yml b/.golangci.yml index 4a7835d..a2de0fa 100644 --- a/.golangci.yml +++ b/.golangci.yml @@ -30,6 +30,7 @@ linters: - unconvert - unparam - whitespace + - forbidigo linters-settings: errcheck: @@ -52,6 +53,12 @@ linters-settings: - gopkg.in/yaml.v2 - github.com/alexflint/go-arg + forbidigo: + forbid: + - '^print(|f|ln)$' + - '^fmt\.Print(|f|ln)$' + + gocritic: # Which checks should be enabled: # See https://go-critic.github.io/overview#checks-overview @@ -82,7 +89,12 @@ issues: # Test-only deps are not restricted. - linters: - depguard - path: _test\.go$|internal/testutil/|internal/integration/ + path: _test\.go$|^internal/testutil/|^internal/integration/ + + # Ok to use fmt.Print in the examples, and in the CLI entrypoint. + - linters: + - forbidigo + path: ^example/|^generate/main\.go$ - linters: - errcheck