armor
armor copied to clipboard
some problem about gzip writer not use sync pool in `middleware/compress.go`
Looking at the git commit history, I found that the sync pool of the gzip writer was removed. The reason is to fix the issue here: https://github.com/labstack/armor/issues/13. But I still don't understand the reason for this deletion. I guess tha Is it because there is no way to return an error when using sync pool?
the removed code:
func gzipPool(config GzipConfig) sync.Pool {
return sync.Pool{
New: func() interface{} {
// can not return error here
w, _ := gzip.NewWriterLevel(ioutil.Discard, config.Level)
return w
},
}
}