Skip to content

Commit a9a5125

Browse files
committed
ci: add golangci-lint for linting
1 parent 8d6ceab commit a9a5125

File tree

3 files changed

+61
-1
lines changed

3 files changed

+61
-1
lines changed

.github/workflows/go-check.yml

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,3 +19,42 @@ jobs:
1919
with:
2020
go-version: "1.24.x"
2121
go-generate-ignore-protoc-version-comments: true
22+
23+
golangci-lint:
24+
runs-on: ubuntu-latest
25+
strategy:
26+
fail-fast: false
27+
matrix:
28+
go: [ "1.23.x", "1.24.x" ]
29+
env:
30+
GOLANGCI_LINT_VERSION: v2.0.2
31+
name: golangci-lint (Go ${{ matrix.go }})
32+
steps:
33+
- uses: actions/checkout@v4
34+
- uses: actions/setup-go@v5
35+
with:
36+
go-version: ${{ matrix.go }}
37+
- name: golangci-lint (Linux)
38+
uses: golangci/golangci-lint-action@v7
39+
with:
40+
args: --timeout=5m
41+
version: ${{ env.GOLANGCI_LINT_VERSION }}
42+
only-new-issues: true
43+
- name: golangci-lint (Windows)
44+
if: success() || failure() # run this step even if the previous one failed
45+
uses: golangci/golangci-lint-action@v7
46+
env:
47+
GOOS: "windows"
48+
with:
49+
args: --timeout=5m
50+
version: ${{ env.GOLANGCI_LINT_VERSION }}
51+
only-new-issues: true
52+
- name: golangci-lint (OSX)
53+
if: success() || failure() # run this step even if the previous one failed
54+
uses: golangci/golangci-lint-action@v7
55+
env:
56+
GOOS: "darwin"
57+
with:
58+
args: --timeout=5m
59+
version: ${{ env.GOLANGCI_LINT_VERSION }}
60+
only-new-issues: true

.golangci.yml

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
version: "2"
2+
3+
run:
4+
timeout: 5m
5+
6+
linters:
7+
enable:
8+
- revive
9+
- unused
10+
- prealloc
11+
12+
settings:
13+
revive:
14+
severity: warning
15+
rules:
16+
- name: unused-parameter
17+
severity: warning
18+
19+
severity:
20+
default: warning
21+

p2p/protocol/autonatv2/server.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -442,7 +442,7 @@ func (r *rateLimiter) Accept(p peer.ID) bool {
442442
return true
443443
}
444444

445-
func (r *rateLimiter) AcceptDialDataRequest(p peer.ID) bool {
445+
func (r *rateLimiter) AcceptDialDataRequest(px peer.ID) bool {
446446
r.mu.Lock()
447447
defer r.mu.Unlock()
448448
if r.closed {

0 commit comments

Comments
 (0)