limiter
limiter copied to clipboard
Find a solution to reduce dependency leak
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:
I do not understand, they are all three in the go.mod https://github.com/ulule/limiter/blob/master/go.mod#L6
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: