mirror of
https://gitlab.torproject.org/tpo/anti-censorship/pluggable-transports/snowflake.git
synced 2025-10-13 20:11:19 -04:00
refactor: change deprecated "io/ioutil" package to recommended "io" package
This commit is contained in:
parent
35984c0876
commit
acce1f1fd9
14 changed files with 25 additions and 39 deletions
|
@ -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
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue