I am very new to golang. I have some handlers that make use of go’s http package. Go version is 1.6.x. Before a handler gets executed, there are some filter operations which may perform operations like rate limit. And the rate limit do some leaky bucket checking, so there is a queue like list and each handler will check and register its timestamp to redis.
Now I know that each handler is handled by go routine as mentioned by . So I am thinking when the handler is accomplished its execution, I can cleanup its related info from redis. However I check online, I do not find doc mentioning how to perform post-operation.
The only info I found so far is  where seemingly I can use channel to receive notification by spawning a go routine for cleanup. Is this the only way to do that. If so, it seems that I need to insert such cleanup function to all endpoints/ handlers I have. If there are 100 endpoints/ handlers, I need to insert 100 lines to the end of all those handlers/ endpoints. Is there better way to do this? Thanks