Skip to content
This repository has been archived by the owner on Jun 5, 2021. It is now read-only.

Commit

Permalink
all: improve linters config and fix some warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
ernado committed Feb 18, 2019
1 parent e55d9b2 commit a9ca8ba
Show file tree
Hide file tree
Showing 4 changed files with 30 additions and 8 deletions.
32 changes: 27 additions & 5 deletions .golangci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ linters-settings:
golint:
min-confidence: 0
gocyclo:
min-complexity: 10
min-complexity: 15
maligned:
suggest-new: true
dupl:
Expand All @@ -23,29 +23,35 @@ 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:
- gocyclo
- errcheck
- dupl
- gosec
- goconst

# Ease some gocritic warnings on test files.
- path: _test\.go
text: "(unnamedResult|exitAfterDefer)"
text: "(unnamedResult|exitAfterDefer|unlambda)"
linters:
- gocritic

Expand All @@ -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:
Expand Down
2 changes: 1 addition & 1 deletion client.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}

Expand Down
2 changes: 1 addition & 1 deletion cmd/stun-client/stun-client.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion fingerprint_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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")
}
Expand Down

0 comments on commit a9ca8ba

Please sign in to comment.