Skip to content

Commit 2227acd

Browse files
committed
changed deprecated ioutil functions to io
1 parent 53c8336 commit 2227acd

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

websocket/websocket.go

+3-4
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@ import (
1717
"encoding/json"
1818
"errors"
1919
"io"
20-
"io/ioutil"
2120
"net"
2221
"net/http"
2322
"net/url"
@@ -208,7 +207,7 @@ again:
208207
n, err = ws.frameReader.Read(msg)
209208
if err == io.EOF {
210209
if trailer := ws.frameReader.TrailerReader(); trailer != nil {
211-
io.Copy(ioutil.Discard, trailer)
210+
io.Copy(io.Discard, trailer)
212211
}
213212
ws.frameReader = nil
214213
goto again
@@ -330,7 +329,7 @@ func (cd Codec[T]) Receive(ws *Conn, v interface{}) (err error) {
330329
ws.rio.Lock()
331330
defer ws.rio.Unlock()
332331
if ws.frameReader != nil {
333-
_, err = io.Copy(ioutil.Discard, ws.frameReader)
332+
_, err = io.Copy(io.Discard, ws.frameReader)
334333
if err != nil {
335334
return err
336335
}
@@ -362,7 +361,7 @@ again:
362361
return ErrFrameTooLarge
363362
}
364363
payloadType := frame.PayloadType()
365-
data, err := ioutil.ReadAll(frame)
364+
data, err := io.ReadAll(frame)
366365
if err != nil {
367366
return err
368367
}

0 commit comments

Comments
 (0)