Skip to content

Commit

Permalink
chore: unnecessary guard around call to delete (#859)
Browse files Browse the repository at this point in the history
  • Loading branch information
testwill committed Oct 18, 2023
1 parent 834f94d commit 779d661
Showing 1 changed file with 2 additions and 6 deletions.
8 changes: 2 additions & 6 deletions middleware/compress.go
Original file line number Diff line number Diff line change
Expand Up @@ -156,12 +156,8 @@ func (c *Compressor) SetEncoder(encoding string, fn EncoderFunc) {

// If we are adding a new encoder that is already registered, we have to
// clear that one out first.
if _, ok := c.pooledEncoders[encoding]; ok {
delete(c.pooledEncoders, encoding)
}
if _, ok := c.encoders[encoding]; ok {
delete(c.encoders, encoding)
}
delete(c.pooledEncoders, encoding)
delete(c.encoders, encoding)

// If the encoder supports Resetting (IoReseterWriter), then it can be pooled.
encoder := fn(ioutil.Discard, c.level)
Expand Down

0 comments on commit 779d661

Please sign in to comment.