Skip to content

Commit 784cb28

Browse files
committed
ci: add golangci-lint
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
1 parent 3faad8a commit 784cb28

File tree

2 files changed

+80
-0
lines changed

2 files changed

+80
-0
lines changed

.github/workflows/ci.yaml

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,21 @@ env:
1313
GOTOOLCHAIN: local
1414

1515
jobs:
16+
lint:
17+
name: Golang-CI Lint
18+
timeout-minutes: 10
19+
runs-on: ubuntu-latest
20+
steps:
21+
- name: Checkout code
22+
uses: actions/checkout@v6
23+
- name: Install Go
24+
uses: actions/setup-go@v6
25+
with:
26+
go-version: stable
27+
- name: Install golangci-lint
28+
uses: golangci/golangci-lint-action@v9
29+
with:
30+
args: --verbose --show-stats
1631
test:
1732
name: Unit test
1833
timeout-minutes: 10

.golangci.yml

Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
version: "2"
2+
3+
linters:
4+
enable:
5+
- bodyclose
6+
- canonicalheader
7+
- errcheck
8+
- errorlint
9+
- forcetypeassert
10+
- gocritic
11+
- godoclint
12+
- nakedret
13+
- perfsprint
14+
- staticcheck
15+
- thelper
16+
- unconvert
17+
- unparam
18+
- whitespace
19+
exclusions:
20+
generated: disable
21+
presets:
22+
- comments
23+
- std-error-handling
24+
rules:
25+
- path: spdy/
26+
linters:
27+
- nakedret
28+
- nonamedreturns
29+
- path: connection.go
30+
linters:
31+
- unparam
32+
text: "result 0 \\(error\\) is always nil" # TODO(thaJeztah): check if errors should be returned
33+
settings:
34+
revive:
35+
rules:
36+
# https://github.com/mgechev/revive/blob/HEAD/RULES_DESCRIPTIONS.md#var-naming
37+
- name: var-naming
38+
severity: warning
39+
disabled: false
40+
exclude: [""]
41+
arguments:
42+
- ["Id"] # AllowList
43+
- [] # DenyList
44+
- - skip-initialism-name-checks: true
45+
upper-case-const: true
46+
staticcheck:
47+
# Enable all options, with some exceptions.
48+
# For defaults, see https://golangci-lint.run/usage/linters/#staticcheck
49+
checks:
50+
- all
51+
- -QF1008 # Omit embedded fields from selector expression; https://staticcheck.dev/docs/checks/#QF1008
52+
- -ST1003 # Poorly chosen identifier; https://staticcheck.dev/docs/checks/#ST1003
53+
54+
formatters:
55+
enable:
56+
- gofumpt
57+
exclusions:
58+
generated: disable
59+
60+
issues:
61+
# Maximum issues count per one linter. Set to 0 to disable. Default is 50.
62+
max-issues-per-linter: 0
63+
64+
# Maximum count of issues with the same text. Set to 0 to disable. Default is 3.
65+
max-same-issues: 0

0 commit comments

Comments
 (0)