Merge pull request #530 from cnphpbb/develop
Update beego.go - Slice types exist trap
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 | ... | ... |
-
Please register or sign in to post a comment