Skip to content

Commit 2519a9a

Browse files
committed
ci(golangci): enable comprehensive linting and update variable initialization
- Add a `.golangci.yaml` configuration file with various linters enabled and specific settings for `gosec` and `perfsprint`. - Change `isTimeout` from being initialized to `true` to being declared as a `bool` variable without an initial value in `plugin.go`. Signed-off-by: appleboy <appleboy.tw@gmail.com>
1 parent 1edb474 commit 2519a9a

2 files changed

Lines changed: 43 additions & 1 deletion

File tree

.golangci.yaml

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
run:
2+
timeout: 5m
3+
linters:
4+
enable:
5+
- asciicheck
6+
- durationcheck
7+
- errcheck
8+
- errorlint
9+
- exportloopref
10+
- gci
11+
- gofmt
12+
- goimports
13+
- gosec
14+
- misspell
15+
- nakedret
16+
- nilerr
17+
- nolintlint
18+
- perfsprint
19+
- revive
20+
- usestdlibvars
21+
- wastedassign
22+
23+
linters-settings:
24+
gosec:
25+
# To select a subset of rules to run.
26+
# Available rules: https://github.com/securego/gosec#available-rules
27+
# Default: [] - means include all rules
28+
includes:
29+
- G102
30+
- G106
31+
- G108
32+
- G109
33+
- G111
34+
- G112
35+
- G201
36+
- G203
37+
perfsprint:
38+
err-error: true
39+
errorf: true
40+
int-conversion: true
41+
sprintf1: true
42+
strconcat: true

plugin.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -137,7 +137,7 @@ func (p Plugin) exec(host string, wg *sync.WaitGroup, errChannel chan error) {
137137
return
138138
}
139139
// read from the output channel until the done signal is passed
140-
isTimeout := true
140+
var isTimeout bool
141141
loop:
142142
for {
143143
select {

0 commit comments

Comments
 (0)