chore: исправить замечания golangci-lint
- wrap_test.go: проверять ошибки newWrapConn/wrapInto во всех тестах - server/wrap.go: nolint на type assertion bufPool (pool New всегда возвращает *[]byte) - captcha/slider.go: обосновать пустой импорт image/jpeg - namegen_test.go: применить закон Де Моргана к условию цикла
This commit is contained in:
1 parent
e2dd09a729
commit
1506dafe3c
4 files changed
+32
-11
No files matched your search
+2
-2
@@ -107,7 +107,7 @@ type wrapPacketConn struct {
|
||||
}
|
||||
|
||||
func (c *wrapPacketConn) ReadFrom(p []byte) (int, net.Addr, error) {
|
||||
bp := bufPool.Get().(*[]byte)
|
||||
bp := bufPool.Get().(*[]byte) //nolint:errcheck // pool New always returns *[]byte
|
||||
buf := *bp
|
||||
need := len(p) + wrapPrefixMax + wrapNonceLen + wrapTagLen
|
||||
if cap(buf) < need {
|
||||
@@ -150,7 +150,7 @@ func (c *wrapPacketConn) WriteTo(p []byte, addr net.Addr) (int, error) {
|
||||
prefixLen := wrapPrefixMin + int(hdr[0]&0x07)
|
||||
wireLen := prefixLen + wrapNonceLen + len(p) + wrapTagLen
|
||||
|
||||
bp := bufPool.Get().(*[]byte)
|
||||
bp := bufPool.Get().(*[]byte) //nolint:errcheck // pool New always returns *[]byte
|
||||
out := *bp
|
||||
if cap(out) < wireLen {
|
||||
out = make([]byte, wireLen)
|
||||
|
||||
Reference in new issue
Block a user