diff --git a/.golangci.yml b/.golangci.yml index ad99fd7..5d9b5d4 100644 --- a/.golangci.yml +++ b/.golangci.yml @@ -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 ``" + 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: diff --git a/client.go b/client.go index 20a0f94..e969ff9 100644 --- a/client.go +++ b/client.go @@ -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) } diff --git a/cmd/stun-client/stun-client.go b/cmd/stun-client/stun-client.go index 3d3d5b4..f3d2dad 100644 --- a/cmd/stun-client/stun-client.go +++ b/cmd/stun-client/stun-client.go @@ -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) diff --git a/fingerprint_test.go b/fingerprint_test.go index 3925cf1..daca2bc 100644 --- a/fingerprint_test.go +++ b/fingerprint_test.go @@ -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") }