mirror of
https://github.com/gortc/stun.git
synced 2025-09-26 20:41:36 +08:00
all: improve linters config and fix some warnings
This commit is contained in:
@@ -4,7 +4,7 @@ linters-settings:
|
||||
golint:
|
||||
min-confidence: 0
|
||||
gocyclo:
|
||||
min-complexity: 10
|
||||
min-complexity: 15
|
||||
maligned:
|
||||
suggest-new: true
|
||||
dupl:
|
||||
@@ -23,18 +23,23 @@ linters-settings:
|
||||
lll:
|
||||
line-length: 140
|
||||
goimports:
|
||||
local-prefixes: github.com/golangci/golangci-lint
|
||||
local-prefixes: github.com/gortc
|
||||
gocritic:
|
||||
enabled-tags:
|
||||
- performance
|
||||
- style
|
||||
- experimental
|
||||
disabled-checks:
|
||||
- wrapperFunc
|
||||
- commentFormatting # https://github.com/go-critic/go-critic/issues/755
|
||||
- sloppyReassign
|
||||
|
||||
issues:
|
||||
exclude:
|
||||
- "`assertHMACSize` - `blocksize` always receives `64`"
|
||||
exclude-rules:
|
||||
- text: "string `<nil>`"
|
||||
linters:
|
||||
- goconst
|
||||
|
||||
# Exclude some linters from running on tests files.
|
||||
- path: _test\.go
|
||||
linters:
|
||||
@@ -42,10 +47,11 @@ issues:
|
||||
- errcheck
|
||||
- dupl
|
||||
- gosec
|
||||
- goconst
|
||||
|
||||
# Ease some gocritic warnings on test files.
|
||||
- path: _test\.go
|
||||
text: "(unnamedResult|exitAfterDefer)"
|
||||
text: "(unnamedResult|exitAfterDefer|unlambda)"
|
||||
linters:
|
||||
- gocritic
|
||||
|
||||
@@ -65,10 +71,26 @@ issues:
|
||||
linters:
|
||||
- gosec
|
||||
- errcheck
|
||||
- unparam
|
||||
|
||||
- path: ^cmd/
|
||||
linters:
|
||||
- gocyclo
|
||||
- path: ^cmd/
|
||||
text: "(unnamedResult|exitAfterDefer)"
|
||||
linters:
|
||||
- gocritic
|
||||
- path: ^message.go$
|
||||
text: "commentedOutCode"
|
||||
linters:
|
||||
- gocritic
|
||||
|
||||
linters:
|
||||
enable-all: true
|
||||
disable:
|
||||
- prealloc
|
||||
- gochecknoglobals
|
||||
- scopelint
|
||||
|
||||
run:
|
||||
skip-dirs:
|
||||
|
@@ -230,7 +230,7 @@ func putClientTransaction(t *clientTransaction) {
|
||||
clientTransactionPool.Put(t)
|
||||
}
|
||||
|
||||
func (t clientTransaction) nextTimeout(now time.Time) time.Time {
|
||||
func (t *clientTransaction) nextTimeout(now time.Time) time.Time {
|
||||
return now.Add(time.Duration(t.attempt+1) * t.rto)
|
||||
}
|
||||
|
||||
|
@@ -16,7 +16,7 @@ func main() {
|
||||
}
|
||||
flag.Parse()
|
||||
addr := flag.Arg(0)
|
||||
if len(addr) == 0 {
|
||||
if addr == "" {
|
||||
addr = "stun.l.google.com:19302"
|
||||
}
|
||||
c, err := stun.Dial("udp", addr)
|
||||
|
@@ -33,7 +33,7 @@ func TestFingerprint_Check(t *testing.T) {
|
||||
if err := Fingerprint.Check(m); err != nil {
|
||||
t.Error(err)
|
||||
}
|
||||
m.Raw[3] = m.Raw[3] + 1
|
||||
m.Raw[3]++
|
||||
if err := Fingerprint.Check(m); err == nil {
|
||||
t.Error("should error")
|
||||
}
|
||||
|
Reference in New Issue
Block a user