Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Possibility to switch back to gorilla/mux #334

Open
KsaweryZietara opened this issue Oct 15, 2024 · 4 comments
Open

Possibility to switch back to gorilla/mux #334

KsaweryZietara opened this issue Oct 15, 2024 · 4 comments

Comments

@KsaweryZietara
Copy link
Contributor

Is your feature request related to a problem? Please describe.

Our broker depends on gorilla/mux router. Version v10.0.0 introduced go-chi/chi router, because gorilla/mux project has been archived. To bump the version of brokerapi we are forced to switch to go-chi/chi.

Describe the solution you'd like

Are you planning going back to gorilla/mux, since it has new maintainers?

Describe alternatives you've considered

No response

Additional context

No response

@blgm
Copy link
Member

blgm commented Oct 17, 2024

With Go 1.22, the standard library http.ServeMux was updated to be able to handle patterns. Previously brokerapi relied on gorillia/mux then go-chi/chi for this. So I think my ideal solution would be to rely only on the Go standard library, and allow consumers to use whichever router they want. Or none.

But this would involve some breaking changes. In particular the AttachRoutes() and WithRouter() option would need to be removed. I don't know what the appetite is for change to this library: chances are that some users would embrace it, but for many it would be an unwelcome cost. Previous breaking changes have been quite easy to implement, but anyone using AttachRoutes() or WithRouter() would have to do some work.

The fact that this issue exists is evidence that at least one user wants some change. @KsaweryZietara, how would you feel about the ideas above? Would just relying on http.ServeMux suit your requirements, or were you looking to use AttachRoutes() with gorilla/mux?

For what it's worth, I have seem some folks use gorilla/mux and go-chi/chi in the same app. I would not recommend it, but it's possible.

@blgm
Copy link
Member

blgm commented Oct 17, 2024

Here's a branch that illustrates the idea: https://github.com/pivotal-cf/brokerapi/tree/chiless

@KsaweryZietara
Copy link
Contributor Author

We will evaluate using the standard library http.ServeMux as you suggested and make a decision based on our findings. Thanks for the proposal and the branch illustrating the idea.

@blgm
Copy link
Member

blgm commented Oct 18, 2024

Hi @KsaweryZietara, just to be clear, the idea would be that brokerapi uses only the standard library. Any consumer could use any router that they like. The brokerapi.New() constructor has always returned a http.Handler and this has been compatible with gorillia/mux, go-chi/chi, and likely many other routers.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants