Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Drop deadcode #26

Merged
merged 1 commit into from
Nov 22, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 1 addition & 12 deletions proxy/proxy.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,31 +37,20 @@ func init() {
}
}

type zstdCloser struct {
*zstd.Decoder
}

func (zc *zstdCloser) Close() error {
zc.Decoder.Close()
return nil
}

func Decompress(rdr io.ReadCloser, encoding string) (io.ReadCloser, error) {
switch encoding {
case "gzip":
decomp, err := gzip.NewReader(rdr)
if err != nil {
return nil, err
}
defer decomp.Close()
bahlo marked this conversation as resolved.
Show resolved Hide resolved
return decomp, nil
case "zstd":
decomp, err := zstd.NewReader(rdr)
if err != nil {
return nil, err
}
// else we leak
return &zstdCloser{Decoder: decomp}, nil
return decomp.IOReadCloser(), nil
default:
return rdr, nil
}
Expand Down