a8c2deb0 by astaxie

Merge pull request #530 from cnphpbb/develop

Update beego.go - Slice types exist trap
2 parents 624f6258 0f015d75
Showing 1 changed file with 5 additions and 5 deletions
...@@ -28,12 +28,12 @@ type GroupRouters []groupRouter ...@@ -28,12 +28,12 @@ type GroupRouters []groupRouter
28 28
29 // Get a new GroupRouters 29 // Get a new GroupRouters
30 func NewGroupRouters() GroupRouters { 30 func NewGroupRouters() GroupRouters {
31 return make([]groupRouter, 0) 31 return make(GroupRouters, 0)
32 } 32 }
33 33
34 // Add Router in the GroupRouters 34 // Add Router in the GroupRouters
35 // it is for plugin or module to register router 35 // it is for plugin or module to register router
36 func (gr GroupRouters) AddRouter(pattern string, c ControllerInterface, mappingMethod ...string) { 36 func (gr *GroupRouters) AddRouter(pattern string, c ControllerInterface, mappingMethod ...string) {
37 var newRG groupRouter 37 var newRG groupRouter
38 if len(mappingMethod) > 0 { 38 if len(mappingMethod) > 0 {
39 newRG = groupRouter{ 39 newRG = groupRouter{
...@@ -48,16 +48,16 @@ func (gr GroupRouters) AddRouter(pattern string, c ControllerInterface, mappingM ...@@ -48,16 +48,16 @@ func (gr GroupRouters) AddRouter(pattern string, c ControllerInterface, mappingM
48 "", 48 "",
49 } 49 }
50 } 50 }
51 gr = append(gr, newRG) 51 *gr = append(*gr, newRG)
52 } 52 }
53 53
54 func (gr GroupRouters) AddAuto(c ControllerInterface) { 54 func (gr *GroupRouters) AddAuto(c ControllerInterface) {
55 newRG := groupRouter{ 55 newRG := groupRouter{
56 "", 56 "",
57 c, 57 c,
58 "", 58 "",
59 } 59 }
60 gr = append(gr, newRG) 60 *gr = append(*gr, newRG)
61 } 61 }
62 62
63 // AddGroupRouter with the prefix 63 // AddGroupRouter with the prefix
......
Styling with Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!