Skip to content

Commit

Permalink
Remove cast.
Browse files Browse the repository at this point in the history
  • Loading branch information
notbdu committed Feb 11, 2019
1 parent 0bce519 commit e7f84de
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 16 deletions.
9 changes: 1 addition & 8 deletions values/decoding/string_decode.go
Original file line number Diff line number Diff line change
Expand Up @@ -61,14 +61,7 @@ func tryDecodeStringDictionary(
if err != nil {
return 0, err
}
// Close the underlying reader if it satisifies the `io.ReadCloser` iface.
rc, ok := reader.(io.ReadCloser)
if ok {
// NB(bodu): We don't need to propagate `Close` errors back up because there aren't any.
// We have two types of string readers. A bytes reader and a compress reader. The bytes reader
// doesn't implement the `io.Closer` iface and the compress reader has no errors when calling `Close`.
defer rc.Close()
}
defer reader.Close()
bytesRead, err := xproto.DecodeStringArray(reader, stringArrayProto, decodeBuf)
if err != nil {
return 0, err
Expand Down
9 changes: 1 addition & 8 deletions values/decoding/varint_int_iterator.go
Original file line number Diff line number Diff line change
Expand Up @@ -53,13 +53,6 @@ func (it *varintIntIterator) Err() error {
func (it *varintIntIterator) Close() {
it.closed = true
it.err = nil
// Close the underlying reader if it satisifies the `io.ReadCloser` iface.
rc, ok := it.reader.(io.ReadCloser)
if ok {
// NB(bodu): We don't need to propagate `Close` errors back up because there aren't any.
// We have two types of string readers. A bytes reader and a compress reader. The bytes reader
// doesn't implement the `io.Closer` iface and the compress reader has no errors when calling `Close`.
rc.Close()
}
it.reader.Close()
it.reader = nil
}

0 comments on commit e7f84de

Please sign in to comment.