Skip to content

Commit 2a0a9d0

Browse files
committed
fix(lint):err check rules and fix config
1 parent d912bea commit 2a0a9d0

2 files changed

Lines changed: 39 additions & 28 deletions

File tree

.golangci.yml

Lines changed: 35 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -1,35 +1,43 @@
1-
version: 2
1+
version: "2"
22

33
run:
4-
timeout: 5m
5-
tests: true
4+
timeout: 5m
5+
tests: true
66

77
linters:
8-
disable-all: true
9-
enable:
10-
- errcheck
11-
- govet
12-
- staticcheck
13-
- errorlint
14-
- errname
15-
- bodyclose
16-
- sqlclosecheck
17-
- noctx
18-
- ineffassign
19-
- unconvert
20-
- bidichk
21-
22-
linters-settings:
8+
default: none
9+
enable:
10+
- errcheck
11+
- govet
12+
- staticcheck
13+
- errorlint
14+
- errname
15+
- bodyclose
16+
- sqlclosecheck
17+
- noctx
18+
- ineffassign
19+
- unconvert
20+
- bidichk
21+
settings:
2322
errcheck:
24-
check-type-assertions: true
25-
check-blank: true
26-
23+
check-type-assertions: true
24+
check-blank: false
25+
exclude-functions:
26+
- fmt.Print
27+
- fmt.Println
28+
- fmt.Printf
29+
- fmt.Fprint
30+
- fmt.Fprintln
31+
- fmt.Fprintf
2732
govet:
28-
enable-all: true
29-
disable:
30-
- fieldalignment
33+
enable-all: true
34+
disable:
35+
- fieldalignment
36+
exclusions:
37+
rules:
38+
- linters: [errcheck]
39+
source: "^\\s*defer "
3140

3241
issues:
33-
exclude-use-default: false
34-
max-issues-per-linter: 0
35-
max-same-issues: 0
42+
max-issues-per-linter: 0
43+
max-same-issues: 0

ipc/server.go

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,10 @@ func NewServer() (*Server, error) {
2424
return nil, err
2525
}
2626

27-
localAddr := conn.LocalAddr().(*net.UDPAddr)
27+
localAddr, ok := conn.LocalAddr().(*net.UDPAddr)
28+
if !ok {
29+
return nil, net.InvalidAddrError("not a UDP address")
30+
}
2831

2932
s := &Server{
3033
conn: conn,

0 commit comments

Comments
 (0)