fix(lint):err check rules and fix config

This commit is contained in:
verse91
2026-05-10 02:08:00 +07:00
parent e062c0a80d
commit 56e04be409
2 changed files with 39 additions and 28 deletions
+15 -7
View File
@@ -1,11 +1,11 @@
version: 2 version: "2"
run: run:
timeout: 5m timeout: 5m
tests: true tests: true
linters: linters:
disable-all: true default: none
enable: enable:
- errcheck - errcheck
- govet - govet
@@ -18,18 +18,26 @@ linters:
- ineffassign - ineffassign
- unconvert - unconvert
- bidichk - bidichk
settings:
linters-settings:
errcheck: errcheck:
check-type-assertions: true check-type-assertions: true
check-blank: true check-blank: false
exclude-functions:
- fmt.Print
- fmt.Println
- fmt.Printf
- fmt.Fprint
- fmt.Fprintln
- fmt.Fprintf
govet: govet:
enable-all: true enable-all: true
disable: disable:
- fieldalignment - fieldalignment
exclusions:
rules:
- linters: [errcheck]
source: "^\\s*defer "
issues: issues:
exclude-use-default: false
max-issues-per-linter: 0 max-issues-per-linter: 0
max-same-issues: 0 max-same-issues: 0
+4 -1
View File
@@ -24,7 +24,10 @@ func NewServer() (*Server, error) {
return nil, err return nil, err
} }
localAddr := conn.LocalAddr().(*net.UDPAddr) localAddr, ok := conn.LocalAddr().(*net.UDPAddr)
if !ok {
return nil, net.InvalidAddrError("not a UDP address")
}
s := &Server{ s := &Server{
conn: conn, conn: conn,