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

The route map is wrong, which is a bit odd #2465

Closed
bambuo opened this issue Aug 12, 2020 · 2 comments · Fixed by #2663
Closed

The route map is wrong, which is a bit odd #2465

bambuo opened this issue Aug 12, 2020 · 2 comments · Fixed by #2663

Comments

@bambuo
Copy link

bambuo commented Aug 12, 2020

The mapping is as follows:

//limit 0:10
job.GET("/details/:id",globalManpowerDemandController.Details)
job.GET("/:limit", globalManpowerDemandController.LimitManpowerDemand)

The error is as follows:

panic: wildcard segment ':limit' conflicts with existing children in path '/api/job/:limit'

At first glance these should be two different paths, but they are identified as conflicting. What should I do?

/details/:id
/:limit
@bambuo
Copy link
Author

bambuo commented Aug 12, 2020

goroutine 1 [running]:
github.com/gin-gonic/gin.(*node).insertChild(0xc00047ce00, 0xc0004a1801, 0xc000093409, 0x6, 0xc000093400, 0xf, 0xc000088b40, 0x6, 0x6)
	D:/.go/pkg/mod/github.com/gin-gonic/gin@v1.6.3/tree.go:314 +0x1036
github.com/gin-gonic/gin.(*node).addRoute(0xc00047ce00, 0xc000093409, 0x6, 0xc000088b40, 0x6, 0x6)
	D:/.go/pkg/mod/github.com/gin-gonic/gin@v1.6.3/tree.go:254 +0x1225
github.com/gin-gonic/gin.(*Engine).addRoute(0xc0001f0280, 0x96acd9, 0x3, 0xc000093400, 0xf, 0xc000088b40, 0x6, 0x6)
	D:/.go/pkg/mod/github.com/gin-gonic/gin@v1.6.3/gin.go:264 +0x1ee
github.com/gin-gonic/gin.(*RouterGroup).handle(0xc0004849c0, 0x96acd9, 0x3, 0x96d9ec, 0x7, 0xc000088b40, 0x6, 0x6, 0x0, 0x0)
	D:/.go/pkg/mod/github.com/gin-gonic/gin@v1.6.3/routergroup.go:75 +0x13a
github.com/gin-gonic/gin.(*RouterGroup).GET(0xc0004849c0, 0x96d9ec, 0x7, 0xc000308140, 0x1, 0x1, 0x0, 0x0)
	D:/.go/pkg/mod/github.com/gin-gonic/gin@v1.6.3/routergroup.go:103 +0x94
main.loadRoute(0xc0001f0280)
	D:/Codes/Go/chbaby-interviewee-server-go/router.go:23 +0x349
main.main()
	D:/Codes/Go/chbaby-interviewee-server-go/main.go:15 +0xf6

@daiaioz
Copy link

daiaioz commented Aug 14, 2020

See #2016 (comment)

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