Skip to content

var MatchedRoutePathParam = "$matchedRoutePath" changed declaration to const MatchedRoutePathParam#379

Open
LeoDiKadyrov wants to merge 1 commit intojulienschmidt:masterfrom
LeoDiKadyrov:router-matchedroutepathparam-refactor
Open

var MatchedRoutePathParam = "$matchedRoutePath" changed declaration to const MatchedRoutePathParam#379
LeoDiKadyrov wants to merge 1 commit intojulienschmidt:masterfrom
LeoDiKadyrov:router-matchedroutepathparam-refactor

Conversation

@LeoDiKadyrov
Copy link
Copy Markdown

@LeoDiKadyrov LeoDiKadyrov commented Feb 19, 2024

I only suggested it due to following reasons:

  • John Carmack once said: "I am a full const nazi nowadays, and I chide any programmer that doesn’t const every variable and parameter that can be."
  • I'm a newbie into development, trying to learn staff and while studying source code of this library, I saw an opportunity for small change and my first PR into open source ever

All tests that are originally in master repo passed green. When I was going through the code it just confused me a bit, that a variable only used in router.go and not really mutated anywhere declared as var. Sorry if it's too small to have anyone attention and a whole PR open for it.


UPD 23.03.2026
Breaking Change: Switching MatchedRoutePathParam from var to const. Any downstream code that previously reassigned httprouter.MatchedRoutePathParam will no longer compile.

@LeoDiKadyrov
Copy link
Copy Markdown
Author

Oh wow, unexpected monday surprise. Appreciate that you directed your attention to my PR. Will call it out in the PR body

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant