Skip to content

Commit 463cffd

Browse files
Lint against fmt.Println except in main.go (#98)
## 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: #98
1 parent ce079a7 commit 463cffd

File tree

1 file changed

+13
-1
lines changed

1 file changed

+13
-1
lines changed

.golangci.yml

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ linters:
3030
- unconvert
3131
- unparam
3232
- whitespace
33+
- forbidigo
3334

3435
linters-settings:
3536
errcheck:
@@ -52,6 +53,12 @@ linters-settings:
5253
- gopkg.in/yaml.v2
5354
- github.com/alexflint/go-arg
5455

56+
forbidigo:
57+
forbid:
58+
- '^print(|f|ln)$'
59+
- '^fmt\.Print(|f|ln)$'
60+
61+
5562
gocritic:
5663
# Which checks should be enabled:
5764
# See https://go-critic.github.io/overview#checks-overview
@@ -82,7 +89,12 @@ issues:
8289
# Test-only deps are not restricted.
8390
- linters:
8491
- depguard
85-
path: _test\.go$|internal/testutil/|internal/integration/
92+
path: _test\.go$|^internal/testutil/|^internal/integration/
93+
94+
# Ok to use fmt.Print in the examples, and in the CLI entrypoint.
95+
- linters:
96+
- forbidigo
97+
path: ^example/|^generate/main\.go$
8698

8799
- linters:
88100
- errcheck

0 commit comments

Comments
 (0)