-
Notifications
You must be signed in to change notification settings - Fork 8k
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
feat(route): add Engine.PathFor function #3589
base: master
Are you sure you want to change the base?
Conversation
any update ? |
It's seem not good, it can not called in the handler. Mostly, it will result a package loop. |
@iflamed, can you please post some code to reproduce the problem you're experiencing? It would be good to cover it with a unit test, if applicable. |
If you place Mostly, we will import import handlerPkg
Router.GET("/path/to/go",handlerPkg.SomeHandler) In handlerPkg, If i want create a path use Router, have to import import routePkg
func SomeHanlder() {
Router.PathFor(getUser, ":name", "gopher")
} @asbjornu It's not very convenient. And these code will result a package loop import. |
@iflamed, right, so your issue is that Would that be a good solution for you? |
No, In fact, I think the most case we use |
@asbjornu Maybe you could learn something from how Laravel framework build path with router. |
move to next v1.11 milestone. |
Adds the
gin.Engine.PathFor
function to retrieve the path of registered handlers. Resolves #3256.