Skip to content

Commit

Permalink
changed deprecated ioutil functions to io
Browse files Browse the repository at this point in the history
  • Loading branch information
ghatdev committed Feb 6, 2023
1 parent 53c8336 commit 2227acd
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions websocket/websocket.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ import (
"encoding/json"
"errors"
"io"
"io/ioutil"
"net"
"net/http"
"net/url"
Expand Down Expand Up @@ -208,7 +207,7 @@ again:
n, err = ws.frameReader.Read(msg)
if err == io.EOF {
if trailer := ws.frameReader.TrailerReader(); trailer != nil {
io.Copy(ioutil.Discard, trailer)
io.Copy(io.Discard, trailer)
}
ws.frameReader = nil
goto again
Expand Down Expand Up @@ -330,7 +329,7 @@ func (cd Codec[T]) Receive(ws *Conn, v interface{}) (err error) {
ws.rio.Lock()
defer ws.rio.Unlock()
if ws.frameReader != nil {
_, err = io.Copy(ioutil.Discard, ws.frameReader)
_, err = io.Copy(io.Discard, ws.frameReader)
if err != nil {
return err
}
Expand Down Expand Up @@ -362,7 +361,7 @@ again:
return ErrFrameTooLarge
}
payloadType := frame.PayloadType()
data, err := ioutil.ReadAll(frame)
data, err := io.ReadAll(frame)
if err != nil {
return err
}
Expand Down

0 comments on commit 2227acd

Please sign in to comment.