1
0
mirror of https://github.com/fumiama/orbyte.git synced 2026-06-11 05:30:29 +08:00

chore: make lint happy

This commit is contained in:
源文雨
2025-02-25 19:09:31 +09:00
parent cc4650333e
commit 343a5d57be

View File

@@ -2,7 +2,6 @@ package pbuf
import ( import (
"bytes" "bytes"
"io"
"unsafe" "unsafe"
"github.com/fumiama/orbyte" "github.com/fumiama/orbyte"
@@ -31,26 +30,22 @@ type buffer struct {
lastRead readOp // last read operation, so that Unread* can work correctly. lastRead readOp // last read operation, so that Unread* can work correctly.
} }
func skip(w *bytes.Buffer, n int) (int, error) { func skip(w *bytes.Buffer, n int) {
if n == 0 { if n == 0 {
return 0, nil return
} }
b := (*buffer)(unsafe.Pointer(w)) b := (*buffer)(unsafe.Pointer(w))
b.lastRead = opInvalid b.lastRead = opInvalid
if len(b.buf) <= b.off { if len(b.buf) <= b.off {
// Buffer is empty, reset to recover space. // Buffer is empty, reset to recover space.
w.Reset() w.Reset()
if n == 0 { return
return 0, nil
}
return 0, io.EOF
} }
n = minnum(n, len(b.buf[b.off:])) n = minnum(n, len(b.buf[b.off:]))
b.off += n b.off += n
if n > 0 { if n > 0 {
b.lastRead = opRead b.lastRead = opRead
} }
return n, nil
} }
// The readOp constants describe the last action performed on // The readOp constants describe the last action performed on