Skip to content

Commit aed5e26

Browse files
committed
ci: adopt golangci-lint v2.0 with custom configuration
- Update golangci-lint GitHub Action to use v7 and set version to v2.0 - Add a .golangci.yml configuration file with a custom set of enabled linters and formatters - Suppress unused error return warning in startConsumer by adding nolint:unparam and always returning nil Signed-off-by: Bo-Yi Wu <[email protected]>
1 parent c2c00b4 commit aed5e26

File tree

3 files changed

+53
-4
lines changed

3 files changed

+53
-4
lines changed

.github/workflows/go.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,9 @@ jobs:
1313
uses: actions/checkout@v4
1414

1515
- name: Setup golangci-lint
16-
uses: golangci/golangci-lint-action@v6
16+
uses: golangci/golangci-lint-action@v7
1717
with:
18-
version: latest
18+
version: v2.0
1919
args: --verbose
2020

2121
# Label of the container job

.golangci.yml

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
version: "2"
2+
linters:
3+
default: none
4+
enable:
5+
- bodyclose
6+
- dogsled
7+
- dupl
8+
- errcheck
9+
- exhaustive
10+
- gochecknoinits
11+
- goconst
12+
- gocritic
13+
- gocyclo
14+
- goprintffuncname
15+
- gosec
16+
- govet
17+
- ineffassign
18+
- lll
19+
- misspell
20+
- nakedret
21+
- noctx
22+
- nolintlint
23+
- staticcheck
24+
- unconvert
25+
- unparam
26+
- unused
27+
- whitespace
28+
exclusions:
29+
generated: lax
30+
presets:
31+
- comments
32+
- common-false-positives
33+
- legacy
34+
- std-error-handling
35+
paths:
36+
- third_party$
37+
- builtin$
38+
- examples$
39+
formatters:
40+
enable:
41+
- gofmt
42+
- gofumpt
43+
- goimports
44+
exclusions:
45+
generated: lax
46+
paths:
47+
- third_party$
48+
- builtin$
49+
- examples$

rabbitmq.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ func NewWorker(opts ...Option) *Worker {
6262
return w
6363
}
6464

65-
func (w *Worker) startConsumer() (err error) {
65+
func (w *Worker) startConsumer() error { //nolint:unparam
6666
w.startOnce.Do(func() {
6767
q, err := w.channel.QueueDeclare(
6868
w.opts.queue, // name
@@ -96,7 +96,7 @@ func (w *Worker) startConsumer() (err error) {
9696
}
9797
})
9898

99-
return err
99+
return nil
100100
}
101101

102102
// Run start the worker

0 commit comments

Comments
 (0)