feat: Export Handlers (req, resp, https)#445
Conversation
This is usufull when handlers will be dynamicaly created and removed.
|
Can you please explain why you can't use the existing methods to manipulate the handlers? Making a private field public is risky, as it cannot be undone. |
|
@elazarl in current implementation, Handlers are manipulated by What I need is to Add / List and Remove handlers to be able to do it dynamically (at run-time). |
This permit to update content without edgecases Signed-off-by: Guilhem Lettron <guilhem@barpilot.io>
|
I don't see why you need indirection. Making them public should be good enough. Slice is already a pointer. Also not sure how you handle concurrency. |
I totally agree with you. I also find this article, not sure if applicable: https://medium.com/swlh/golang-tips-why-pointers-to-slices-are-useful-and-how-ignoring-them-can-lead-to-tricky-bugs-cac90f72e77b |
|
@elazarl I did more tests and slice is not updated if it's not a pointer. |
|
@guilhem what I suggest is, add a single handler that has internal handlers, and handle concurrency inside We'll add this as an extension. What do you think? |
I will try to do this solution :) |
This is usufull when handlers will be dynamicaly created and removed.