mirror of
https://github.com/gortc/stun.git
synced 2025-09-26 20:41:36 +08:00
all: fix lint issues
This commit is contained in:
@@ -1,3 +1,4 @@
|
|||||||
|
# v1.22.2
|
||||||
linters-settings:
|
linters-settings:
|
||||||
govet:
|
govet:
|
||||||
check-shadowing: true
|
check-shadowing: true
|
||||||
@@ -32,8 +33,7 @@ issues:
|
|||||||
- "`assertHMACSize` - `blocksize` always receives `64`"
|
- "`assertHMACSize` - `blocksize` always receives `64`"
|
||||||
exclude-rules:
|
exclude-rules:
|
||||||
- text: "string `<nil>`"
|
- text: "string `<nil>`"
|
||||||
linters:
|
linters: [goconst]
|
||||||
- goconst
|
|
||||||
|
|
||||||
# Exclude some linters from running on tests files.
|
# Exclude some linters from running on tests files.
|
||||||
- path: _test\.go
|
- path: _test\.go
|
||||||
@@ -43,23 +43,23 @@ issues:
|
|||||||
- dupl
|
- dupl
|
||||||
- gosec
|
- gosec
|
||||||
- goconst
|
- goconst
|
||||||
|
- funlen
|
||||||
|
- gocognit
|
||||||
|
- gomnd
|
||||||
|
|
||||||
# Ease some gocritic warnings on test files.
|
# Ease some gocritic warnings on test files.
|
||||||
- path: _test\.go
|
- path: _test\.go
|
||||||
text: "(unnamedResult|exitAfterDefer|unlambda)"
|
text: "(unnamedResult|exitAfterDefer|unlambda)"
|
||||||
linters:
|
linters: [gocritic]
|
||||||
- gocritic
|
|
||||||
|
|
||||||
# Exclude known linters from partially hard-vendored code,
|
# Exclude known linters from partially hard-vendored code,
|
||||||
# which is impossible to exclude via "nolint" comments.
|
# which is impossible to exclude via "nolint" comments.
|
||||||
- path: internal/hmac/
|
- path: internal/hmac/
|
||||||
text: "weak cryptographic primitive"
|
text: "weak cryptographic primitive"
|
||||||
linters:
|
linters: [gosec]
|
||||||
- gosec
|
|
||||||
- path: internal/hmac/
|
- path: internal/hmac/
|
||||||
text: "Write\\` is not checked"
|
text: "Write\\` is not checked"
|
||||||
linters:
|
linters: [errcheck]
|
||||||
- errcheck
|
|
||||||
|
|
||||||
# Ease linting on benchmarking code.
|
# Ease linting on benchmarking code.
|
||||||
- path: cmd/stun-bench/
|
- path: cmd/stun-bench/
|
||||||
@@ -71,10 +71,12 @@ issues:
|
|||||||
- path: ^cmd/
|
- path: ^cmd/
|
||||||
linters:
|
linters:
|
||||||
- gocyclo
|
- gocyclo
|
||||||
|
- gocognit
|
||||||
|
- gomnd
|
||||||
- path: ^cmd/
|
- path: ^cmd/
|
||||||
text: "(unnamedResult|exitAfterDefer)"
|
text: "(unnamedResult|exitAfterDefer)"
|
||||||
linters:
|
linters: [gocritic]
|
||||||
- gocritic
|
|
||||||
- text: evalOrder
|
- text: evalOrder
|
||||||
path: helpers
|
path: helpers
|
||||||
source: "Build"
|
source: "Build"
|
||||||
@@ -85,6 +87,10 @@ linters:
|
|||||||
- prealloc
|
- prealloc
|
||||||
- gochecknoglobals
|
- gochecknoglobals
|
||||||
- scopelint
|
- scopelint
|
||||||
|
- funlen
|
||||||
|
- wsl
|
||||||
|
- godox
|
||||||
|
- gomnd
|
||||||
|
|
||||||
run:
|
run:
|
||||||
skip-dirs:
|
skip-dirs:
|
||||||
|
@@ -22,8 +22,9 @@ var ErrFingerprintMismatch = errors.New("fingerprint check failed")
|
|||||||
var Fingerprint FingerprintAttr
|
var Fingerprint FingerprintAttr
|
||||||
|
|
||||||
const (
|
const (
|
||||||
fingerprintXORValue uint32 = 0x5354554e //nolint:staticcheck
|
//nolint:staticcheck // explicit type
|
||||||
fingerprintSize = 4 // 32 bit
|
fingerprintXORValue uint32 = 0x5354554e
|
||||||
|
fingerprintSize = 4 // 32 bit
|
||||||
)
|
)
|
||||||
|
|
||||||
// FingerprintValue returns CRC-32 of b XOR-ed by 0x5354554e.
|
// FingerprintValue returns CRC-32 of b XOR-ed by 0x5354554e.
|
||||||
|
2
xor.go
2
xor.go
@@ -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
|
// xorBytes xors the bytes in a and b. The destination is assumed to have enough
|
||||||
// space. Returns the number of bytes xor'd.
|
// 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 {
|
if supportsUnaligned {
|
||||||
return fastXORBytes(dst, a, b)
|
return fastXORBytes(dst, a, b)
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user