Skip to content

some problem about gzip writer not use sync pool in middleware/compress.go #57

Open
@imxyb

Description

@imxyb

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: #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
		},
	}
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions