all: fix lint issues

This commit is contained in:
Aleksandr Razumov
2020-01-01 21:22:13 +03:00
parent 06fd80995a
commit 6c9f9fb909
3 changed files with 20 additions and 13 deletions

View File

@@ -1,3 +1,4 @@
# v1.22.2
linters-settings:
govet:
check-shadowing: true
@@ -32,8 +33,7 @@ issues:
- "`assertHMACSize` - `blocksize` always receives `64`"
exclude-rules:
- text: "string `<nil>`"
linters:
- goconst
linters: [goconst]
# Exclude some linters from running on tests files.
- path: _test\.go
@@ -43,23 +43,23 @@ issues:
- dupl
- gosec
- goconst
- funlen
- gocognit
- gomnd
# Ease some gocritic warnings on test files.
- path: _test\.go
text: "(unnamedResult|exitAfterDefer|unlambda)"
linters:
- gocritic
linters: [gocritic]
# Exclude known linters from partially hard-vendored code,
# which is impossible to exclude via "nolint" comments.
- path: internal/hmac/
text: "weak cryptographic primitive"
linters:
- gosec
linters: [gosec]
- path: internal/hmac/
text: "Write\\` is not checked"
linters:
- errcheck
linters: [errcheck]
# Ease linting on benchmarking code.
- path: cmd/stun-bench/
@@ -71,10 +71,12 @@ issues:
- path: ^cmd/
linters:
- gocyclo
- gocognit
- gomnd
- path: ^cmd/
text: "(unnamedResult|exitAfterDefer)"
linters:
- gocritic
linters: [gocritic]
- text: evalOrder
path: helpers
source: "Build"
@@ -85,6 +87,10 @@ linters:
- prealloc
- gochecknoglobals
- scopelint
- funlen
- wsl
- godox
- gomnd
run:
skip-dirs:

View File

@@ -22,8 +22,9 @@ var ErrFingerprintMismatch = errors.New("fingerprint check failed")
var Fingerprint FingerprintAttr
const (
fingerprintXORValue uint32 = 0x5354554e //nolint:staticcheck
fingerprintSize = 4 // 32 bit
//nolint:staticcheck // explicit type
fingerprintXORValue uint32 = 0x5354554e
fingerprintSize = 4 // 32 bit
)
// FingerprintValue returns CRC-32 of b XOR-ed by 0x5354554e.

2
xor.go
View File

@@ -54,7 +54,7 @@ func safeXORBytes(dst, a, b []byte) int {
// xorBytes xors the bytes in a and b. The destination is assumed to have enough
// space. Returns the number of bytes xor'd.
func xorBytes(dst, a, b []byte) int {
func xorBytes(dst, a, b []byte) int { //nolint:unparam // code from std
if supportsUnaligned {
return fastXORBytes(dst, a, b)
}