Skip to content

Commit 48d9661

Browse files
use forbidigo to check improper use of fmt.* or os.* function in cli pkg
1 parent 6417d89 commit 48d9661

File tree

2 files changed

+24
-116
lines changed

2 files changed

+24
-116
lines changed

.golangci.yml

Lines changed: 24 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -8,28 +8,36 @@ linters:
88
disable-all: true
99
# Enable specific linter
1010
enable:
11+
# Nice to have
12+
#- depguard
1113
#- errcheck
14+
#- gocritic
15+
#- thelper
1216
- errorlint
1317
- exportloopref
18+
- forbidigo
1419
- gofmt
1520
- goimports
21+
- gosec
1622
- gosimple
1723
- govet
18-
- revive
19-
- gosec
24+
- ineffassign
2025
- misspell
26+
- revive
2127
- staticcheck
28+
- tenv
2229
- typecheck
2330
- unconvert
24-
- ineffassign
25-
- tenv
26-
# Nice to have
27-
#- thelper
28-
#- depguard
29-
#We have to dig deeper
30-
#- gocritic
3131

3232
linters-settings:
33+
forbidigo:
34+
forbid:
35+
- p: ^(fmt\.Print(|f|ln)|print|println)$ # Optional message that gets included in error reports.
36+
msg: in cli package use `feedback.*` instead
37+
- p: (os\.(Stdout|Stderr|Stdin))(# )?
38+
msg: in cli package use `feedback.*` instead
39+
analyze-types: true
40+
3341
revive:
3442
confidence: 0.8
3543
rules:
@@ -119,3 +127,10 @@ issues:
119127
- linters: [revive]
120128
path: internal/algorithms/channels.go
121129
text: "empty-block"
130+
131+
# Run linters only on specific path
132+
- path-except: internal/cli/
133+
linters:
134+
- forbidigo
135+
- path: internal/cli/feedback/
136+
linters: [forbidigo]

internal/cli/cli_test.go

Lines changed: 0 additions & 107 deletions
This file was deleted.

0 commit comments

Comments
 (0)