Skip to content

Commit 6e3def2

Browse files
committed
refactor: modified ControllerWrapper interface and router NewGroup function
1 parent bc9404e commit 6e3def2

File tree

2 files changed

+5
-4
lines changed

2 files changed

+5
-4
lines changed

http/route/controller.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ type (
44
// ControllerWrapper is the interface for the route controller
55
ControllerWrapper interface {
66
RegisterRoutes()
7-
RegisterRouteGroups()
7+
RegisterGroups()
88
}
99

1010
// Controller is the struct for the route controller

http/route/router.go

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ type (
1212
HandleFunc(path string, handler http.HandlerFunc)
1313
RegisterRoute(path string, handler http.HandlerFunc)
1414
RegisterHandler(path string, handler http.Handler)
15-
NewGroup(path string) (*Router, error)
15+
NewGroup(path string) *Router
1616
RegisterGroup(path string, router *Router)
1717
}
1818

@@ -113,6 +113,7 @@ func (r *Router) RegisterGroup(path string, router *Router) {
113113
}
114114

115115
// NewGroup creates a new router group with a path
116-
func (r *Router) NewGroup(path string) (*Router, error) {
117-
return NewGroup(r, path)
116+
func (r *Router) NewGroup(path string) *Router {
117+
newGroup, _ := NewGroup(r, path)
118+
return newGroup
118119
}

0 commit comments

Comments
 (0)