refactor: change deprecated "io/ioutil" package to recommended "io" package

This commit is contained in:
am3o 2024-02-17 12:47:22 +01:00
parent 35984c0876
commit acce1f1fd9
No known key found for this signature in database
GPG key ID: F76214F50EEA64B5
14 changed files with 25 additions and 39 deletions

View file

@ -43,7 +43,6 @@ package encapsulation
import (
"errors"
"io"
"io/ioutil"
)
// ErrTooLong is the error returned when an encoded length prefix is longer than
@ -93,7 +92,7 @@ func ReadData(r io.Reader, p []byte) (int, error) {
// If the caller's buffer was too short, discard
// the rest of the data and return
// io.ErrShortBuffer.
_, err = io.CopyN(ioutil.Discard, r, int64(n-numData))
_, err = io.CopyN(io.Discard, r, int64(n-numData))
if err == nil {
err = io.ErrShortBuffer
}
@ -103,7 +102,7 @@ func ReadData(r io.Reader, p []byte) (int, error) {
}
return numData, err
} else if n > 0 {
_, err := io.CopyN(ioutil.Discard, r, int64(n))
_, err := io.CopyN(io.Discard, r, int64(n))
if err == io.EOF {
err = io.ErrUnexpectedEOF
}