Skip to content

Commit

Permalink
Drop deadcode
Browse files Browse the repository at this point in the history
  • Loading branch information
lukasmalkmus committed Nov 22, 2021
1 parent 4b2bd96 commit e452936
Showing 1 changed file with 1 addition and 12 deletions.
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()
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

0 comments on commit e452936

Please # to comment.