Skip to content

Commit b42efe2

Browse files
committed
Update golangci-lint
1 parent 09d1d97 commit b42efe2

File tree

4 files changed

+56
-29
lines changed

4 files changed

+56
-29
lines changed

.github/workflows/lint.yml

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -20,21 +20,17 @@ jobs:
2020
runs-on: ubuntu-latest
2121
steps:
2222
- name: Checkout
23-
uses: actions/checkout@v4
23+
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5
2424
with:
2525
fetch-depth: 0
2626
- name: Setup Go
2727
uses: actions/setup-go@v5
2828
with:
29-
go-version: ^1.23
30-
- name: Cache go module
31-
uses: actions/cache@v4
32-
with:
33-
path: |
34-
~/go/pkg/mod
35-
key: go-${{ hashFiles('**/go.sum') }}
29+
go-version: ^1.25
3630
- name: golangci-lint
37-
uses: golangci/golangci-lint-action@v6
31+
uses: golangci/golangci-lint-action@v8
3832
with:
3933
version: latest
40-
args: .
34+
args: --timeout=30m
35+
install-mode: binary
36+
verify: false

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
11
/.idea/
22
/vendor/
33
.DS_Store
4+
!/README.md
5+
/*.md

.golangci.yml

Lines changed: 45 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,49 @@
1+
version: "2"
2+
run:
3+
go: "1.25"
14
linters:
2-
disable-all: true
5+
default: none
36
enable:
4-
- gofumpt
57
- govet
6-
- gci
7-
- staticcheck
8-
- paralleltest
98
- ineffassign
10-
11-
linters-settings:
12-
gci:
13-
custom-order: true
14-
sections:
15-
- standard
16-
- prefix(github.com/sagernet/)
17-
- default
18-
19-
run:
20-
go: "1.23"
9+
- paralleltest
10+
- staticcheck
11+
settings:
12+
staticcheck:
13+
checks:
14+
- all
15+
- -S1000
16+
- -S1008
17+
- -S1017
18+
- -ST1003
19+
- -QF1001
20+
- -QF1003
21+
- -QF1008
22+
exclusions:
23+
generated: lax
24+
presets:
25+
- comments
26+
- common-false-positives
27+
- legacy
28+
- std-error-handling
29+
paths:
30+
- third_party$
31+
- builtin$
32+
- examples$
33+
formatters:
34+
enable:
35+
- gci
36+
- gofumpt
37+
settings:
38+
gci:
39+
sections:
40+
- standard
41+
- prefix(github.com/sagernet/)
42+
- default
43+
custom-order: true
44+
exclusions:
45+
generated: lax
46+
paths:
47+
- third_party$
48+
- builtin$
49+
- examples$

tun_offload_linux.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -149,12 +149,12 @@ func (t *tcpGROTable) insert(pkt []byte, srcAddrOffset, dstAddrOffset, tcphOffse
149149
}
150150

151151
func (t *tcpGROTable) updateAt(item tcpGROItem, i int) {
152-
items, _ := t.itemsByFlow[item.key]
152+
items := t.itemsByFlow[item.key]
153153
items[i] = item
154154
}
155155

156156
func (t *tcpGROTable) deleteAt(key tcpFlowKey, i int) {
157-
items, _ := t.itemsByFlow[key]
157+
items := t.itemsByFlow[key]
158158
items = append(items[:i], items[i+1:]...)
159159
t.itemsByFlow[key] = items
160160
}
@@ -254,7 +254,7 @@ func (u *udpGROTable) insert(pkt []byte, srcAddrOffset, dstAddrOffset, udphOffse
254254
}
255255

256256
func (u *udpGROTable) updateAt(item udpGROItem, i int) {
257-
items, _ := u.itemsByFlow[item.key]
257+
items := u.itemsByFlow[item.key]
258258
items[i] = item
259259
}
260260

0 commit comments

Comments
 (0)