Skip to content

Commit

Permalink
go: Use errors.Is over ==
Browse files Browse the repository at this point in the history
Client: go

Fix 2 instances we are using == to check on error but should have used
errors.Is instead.
  • Loading branch information
fishy committed May 10, 2024
1 parent 42dbefb commit fa9af0a
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions lib/go/thrift/header_transport.go
Expand Up @@ -128,7 +128,7 @@ var _ io.ReadCloser = (*TransformReader)(nil)
//
// If you don't know the closers capacity beforehand, just use
//
// &TransformReader{Reader: baseReader}
// &TransformReader{Reader: baseReader}
//
// instead would be sufficient.
func NewTransformReaderWithCapacity(baseReader io.Reader, capacity int) *TransformReader {
Expand Down Expand Up @@ -544,7 +544,7 @@ func (t *THeaderTransport) Read(p []byte) (read int, err error) {
// the last Read finished the frame, do endOfFrame
// handling here.
err = t.endOfFrame()
} else if err == io.EOF {
} else if errors.Is(err, io.EOF) {
err = t.endOfFrame()
if err != nil {
return
Expand Down
2 changes: 1 addition & 1 deletion lib/go/thrift/simple_json_protocol.go
Expand Up @@ -1195,7 +1195,7 @@ func (p *TSimpleJSONProtocol) readNumeric() (Numeric, error) {
for continueFor {
c, err := p.reader.ReadByte()
if err != nil {
if err == io.EOF {
if errors.Is(err, io.EOF) {
break
}
return NUMERIC_NULL, NewTProtocolException(err)
Expand Down

0 comments on commit fa9af0a

Please sign in to comment.