mirror of
https://github.com/kubeshark/kubeshark.git
synced 2025-09-27 05:23:06 +00:00
17 lines
249 B
Go
17 lines
249 B
Go
package kafka
|
|
|
|
import "bufio"
|
|
|
|
func discardN(r *bufio.Reader, sz int, n int) (int, error) {
|
|
var err error
|
|
if n <= sz {
|
|
n, err = r.Discard(n)
|
|
} else {
|
|
n, err = r.Discard(sz)
|
|
if err == nil {
|
|
err = errShortRead
|
|
}
|
|
}
|
|
return sz - n, err
|
|
}
|