labstack / labstack/armor

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

Open
#57 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Go
Stars
1.7k
Forks
64
PR merge metrics
No merged PRs in 30d

Description

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

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the commit history for middleware/compress.go and compare the removed gzipPool code with the current implementation. Read the linked labstack/armor issue 13 to understand why the pool was removed. Done means documenting the reason and, if a change is justified, defining the expected gzip writer behavior and validating it with relevant tests.

Written by the indexing model from the issue text.

Assessment

Tech stack
go
Domain
backend
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.