refactor routeRegexp, particularily newRouteRegexp.#328
Merged
Conversation
The existing options matchPrefix, matchHost, and matchQueries are mutually exclusive so there's no point in having a separate boolean argument for each one. It's clearer if there's a single type variable. strictSlash and useEncodedPath were also being passed as naked bools so I've wrapped these in a struct called routeRegexpOptions for more clarity at the call site.
elithrar
approved these changes
Jan 5, 2018
|
|
||
| type regexpType int | ||
|
|
||
| const ( |
Contributor
|
Thanks for this Kamil! Would be nice for the both of us to continue to
refactor some of the internals: mux is a bit of a beast 😉
…On Fri, Jan 5, 2018 at 10:41 AM Kamil Kisiel ***@***.***> wrote:
Merged #328 <#328>.
—
You are receiving this because your review was requested.
Reply to this email directly, view it on GitHub
<#328 (comment)>, or mute the
thread
<https://github.com/notifications/unsubscribe-auth/AABIcJJjGI9-oowYpPbb-GploqS-owCPks5tHmy8gaJpZM4RT3ix>
.
|
Contributor
Author
|
Definitely. I actually tried to refactor this code at least 4 times over the past few years, using interfaces and different types for matchers, but it never really worked out. This seems to at least make it a bit clearer for now. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The existing options matchPrefix, matchHost, and matchQueries are
mutually exclusive so there's no point in having a separate boolean
argument for each one. It's clearer if there's a single type variable.
strictSlash and useEncodedPath were also being passed as naked bools so
I've wrapped these in a struct called routeRegexpOptions for more clarity
at the call site.