limiter icon indicating copy to clipboard operation
limiter copied to clipboard

Find a solution to reduce dependency leak

Open novln opened this issue 4 years ago • 2 comments

Currently, while using github.com/ulule/limiter it doesn't download gin, redis or even fasthttp if you doesn't use it.

It bothers me that these libraries are exported to the go.sum of a project, even though it's not included in it's go.mod.

Maybe there is a solution to reduce this annoyance. I don't know :man_shrugging:

novln avatar Mar 23 '20 17:03 novln

I do not understand, they are all three in the go.mod https://github.com/ulule/limiter/blob/master/go.mod#L6

edouardparis avatar Mar 24 '20 09:03 edouardparis

Let's say you have a project named foobar, this one uses redis and chi (for example).

The foobar project will not import the limiter middleware gin or fasthttp. And as such, it will not declare github.com/gin-gonic/gin and github.com/valyala/fasthttp in its (foobar project) go.mod nor download it, which is a good thing.

However, the foobar project will have a declaration of github.com/gin-gonic/gin and github.com/valyala/fasthttp in its go.sum. Which in a sense, is a "dependency leak", because you "import" something you don't use.

I know it's a minor problem, but I would like as much as possible to not "force" dependency to limiter users if they don't use gin or fasthttp for example.

I hope I was more precise and clear with this explanation :crossed_fingers:

novln avatar Mar 24 '20 09:03 novln