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

refactor routeRegexp, particularily newRouteRegexp. #328

Merged
merged 1 commit into from
Jan 5, 2018

Conversation

kisielk
Copy link
Contributor

@kisielk kisielk commented Jan 5, 2018

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.

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.

type regexpType int

const (
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👌🏼

@kisielk kisielk merged commit 512169e into master Jan 5, 2018
@elithrar
Copy link
Contributor

elithrar commented Jan 5, 2018 via email

@kisielk
Copy link
Contributor Author

kisielk commented Jan 5, 2018

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.

@kisielk kisielk deleted the routeRegexp-refactor branch March 9, 2018 23:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants